CPP-AP 2.2.6
Command-line argument parser for C++20
Loading...
Searching...
No Matches
argument_token.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 <string>
10
11namespace ap::detail {
12
16 enum class token_type : bool { t_flag, t_value };
17 using enum token_type;
18
19 argument_token() = delete;
20
21 argument_token(const argument_token&) = default;
22 argument_token(argument_token&&) = default;
23
24 argument_token& operator=(const argument_token&) = default;
25 argument_token& operator=(argument_token&&) = default;
26
32 argument_token(const token_type type, const std::string& value) : type(type), value(value) {}
33
34 ~argument_token() = default;
35
41 bool operator==(const argument_token& other) const noexcept {
42 return this->type == other.type and this->value == other.value;
43 }
44
45 token_type type;
46 std::string value;
47};
48
49} // namespace ap::detail
Structure representing a single command-line argument token.
token_type
The token type discriminator.
bool operator==(const argument_token &other) const noexcept
Equality operator for comparing argument_token instances.
argument_token(const token_type type, const std::string &value)
Constructor of a command-line argument.