CPP-AP 3.0.1
Command-line argument parser for C++20
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1// Copyright (c) 2023-2025 Jakub MusiaƂ
2// This file is part of the CPP-AP project (https://github.com/SpectraL519/cpp-ap).
3// Licensed under the MIT License. See the LICENSE file in the project root for full license information.
4
6
7#pragma once
8
9#include <cstdint>
10#include <format>
11#include <iostream>
12
13namespace ap {
14
20struct none_type {};
21
23struct version {
24 std::uint32_t major = 0u;
25 std::uint32_t minor = 0u;
26 std::uint32_t patch = 0u;
27
29 [[nodiscard]] std::string str() const noexcept {
30 return std::format("v{}.{}.{}", this->major, this->minor, this->patch);
31 }
32
34 friend std::ostream& operator<<(std::ostream& os, const version& v) {
35 os << v.str();
36 return os;
37 }
38};
39
40} // namespace ap
A type representing the absence of a value. This type is used for arguments that should not store any...
Definition types.hpp:20
A helper structure used to represent a program's version.
Definition types.hpp:23
std::string str() const noexcept
Converts the structure into a string in the v{major}.{minor}.{path} format.
Definition types.hpp:29
friend std::ostream & operator<<(std::ostream &os, const version &v)
The stream insertion operator.
Definition types.hpp:34
std::uint32_t major
The major version number.
Definition types.hpp:24
std::uint32_t minor
The minor version number.
Definition types.hpp:25
std::uint32_t patch
The patch number.
Definition types.hpp:26