argagg
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
argagg::parser_results Struct Reference

Represents all results of the parser including options and positional arguments. More...

#include <argagg.hpp>

Public Member Functions

bool has_option (const std::string &name) const
 Used to check if an option was specified at all.
 
option_resultsoperator[] (const std::string &name)
 Get the parser results for the given definition. If the definition never showed up then the exception from the unordered_map access will bubble through so check if the flag exists in the first place with has_option().
 
const option_resultsoperator[] (const std::string &name) const
 Get the parser results for the given definition. If the definition never showed up then the exception from the unordered_map access will bubble through so check if the flag exists in the first place with has_option().
 
std::size_t count () const
 Gets the number of positional arguments.
 
const char * operator[] (std::size_t index) const
 Gets a positional argument by index.
 
template<typename T >
as (std::size_t i=0) const
 Gets a positional argument converted to the given type.
 
template<typename T >
std::vector< T > all_as () const
 Gets all positional arguments converted to the given type.
 

Public Attributes

const char * program
 Returns the name of the program from the original arguments list. This is always the first argument.
 
std::unordered_map< std::string, option_resultsoptions
 Maps from definition name to the structure which contains the parser results for that definition.
 
std::vector< const char * > pos
 Vector of positional arguments.
 

Detailed Description

Represents all results of the parser including options and positional arguments.

Definition at line 411 of file argagg.hpp.

Member Function Documentation

◆ all_as()

template<typename T >
std::vector< T > argagg::parser_results::all_as ( ) const

Gets all positional arguments converted to the given type.

Definition at line 902 of file argagg.hpp.

◆ as()

template<typename T >
T argagg::parser_results::as ( std::size_t i = 0) const

Gets a positional argument converted to the given type.

Definition at line 895 of file argagg.hpp.

◆ count()

std::size_t argagg::parser_results::count ( ) const
inline

Gets the number of positional arguments.

Definition at line 881 of file argagg.hpp.

◆ has_option()

bool argagg::parser_results::has_option ( const std::string & name) const
inline

Used to check if an option was specified at all.

Definition at line 850 of file argagg.hpp.

◆ operator[]() [1/3]

option_results & argagg::parser_results::operator[] ( const std::string & name)
inline

Get the parser results for the given definition. If the definition never showed up then the exception from the unordered_map access will bubble through so check if the flag exists in the first place with has_option().

Definition at line 858 of file argagg.hpp.

◆ operator[]() [2/3]

const option_results & argagg::parser_results::operator[] ( const std::string & name) const
inline

Get the parser results for the given definition. If the definition never showed up then the exception from the unordered_map access will bubble through so check if the flag exists in the first place with has_option().

Definition at line 870 of file argagg.hpp.

◆ operator[]() [3/3]

const char * argagg::parser_results::operator[] ( std::size_t index) const
inline

Gets a positional argument by index.

Definition at line 888 of file argagg.hpp.

Member Data Documentation

◆ options

std::unordered_map<std::string, option_results> argagg::parser_results::options

Maps from definition name to the structure which contains the parser results for that definition.

Definition at line 425 of file argagg.hpp.

◆ pos

std::vector<const char*> argagg::parser_results::pos

Vector of positional arguments.

Definition at line 431 of file argagg.hpp.

◆ program

const char* argagg::parser_results::program

Returns the name of the program from the original arguments list. This is always the first argument.

Definition at line 418 of file argagg.hpp.


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