CPP-AP 2.7.0
Command-line argument parser for C++20
Loading...
Searching...
No Matches
ap::detail::argument_token Struct Reference

Structure representing a single command-line argument token. More...

#include <argument_token.hpp>

Public Types

enum class  token_type : std::uint8_t { t_flag_primary , t_flag_secondary , t_value }
 The token type discriminator. More...
 
using arg_ptr_opt_t = uptr_opt_t< detail::argument_base >
 

Public Member Functions

bool operator== (const argument_token &other) const noexcept
 Equality operator for comparing argument_token instances.
 
bool is_flag_token () const noexcept
 Checks whether the type member is a flag token type.
 
bool is_valid_flag_token () const noexcept
 Checks whether the token represents a valid flag.
 

Public Attributes

token_type type
 The token's type discrimiator value.
 
std::string value
 The actual token's value.
 
arg_ptr_opt_t arg = std::nullopt
 The corresponding argument.
 

Detailed Description

Structure representing a single command-line argument token.

Definition at line 20 of file argument_token.hpp.

Member Typedef Documentation

◆ arg_ptr_opt_t

Member Enumeration Documentation

◆ token_type

enum class ap::detail::argument_token::token_type : std::uint8_t
strong

The token type discriminator.

Enumerator
t_flag_primary 

Represents the primary (–) flag argument.

t_flag_secondary 

Represents the secondary (-) flag argument.

t_value 

Represents a value argument.

Definition at line 24 of file argument_token.hpp.

Member Function Documentation

◆ is_flag_token()

bool ap::detail::argument_token::is_flag_token ( ) const
inlinenoexcept

Checks whether the type member is a flag token type.

Returns
true if type is either t_flag_primary or t_flag_secondary, false otherwise.

Definition at line 44 of file argument_token.hpp.

◆ is_valid_flag_token()

bool ap::detail::argument_token::is_valid_flag_token ( ) const
inlinenoexcept

Checks whether the token represents a valid flag.

A token is considered a valid flag token if:

  1. The token's type if a valid flag token type (t_flag_primary or t_flag_secondary)
  2. The token's arg member is set.
Returns
true if type is either t_flag_primary or t_flag_secondary, false otherwise.

Definition at line 57 of file argument_token.hpp.

◆ operator==()

bool ap::detail::argument_token::operator== ( const argument_token other) const
inlinenoexcept

Equality operator for comparing argument_token instances.

Parameters
otherAn argument_token instance to compare with.
Returns
Boolean statement of equality comparison.

Definition at line 36 of file argument_token.hpp.

Member Data Documentation

◆ arg

arg_ptr_opt_t ap::detail::argument_token::arg = std::nullopt

The corresponding argument.

Definition at line 63 of file argument_token.hpp.

◆ type

token_type ap::detail::argument_token::type

The token's type discrimiator value.

Definition at line 61 of file argument_token.hpp.

◆ value

std::string ap::detail::argument_token::value

The actual token's value.

Definition at line 62 of file argument_token.hpp.


The documentation for this struct was generated from the following file: