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. More... | |
option_results & | operator[] (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(). More... | |
const option_results & | operator[] (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(). More... | |
std::size_t | count () const |
Gets the number of positional arguments. More... | |
const char * | operator[] (std::size_t index) const |
Gets a positional argument by index. More... | |
template<typename T > | |
T | as (std::size_t i=0) const |
Gets a positional argument converted to the given type. More... | |
template<typename T > | |
std::vector< T > | all_as () const |
Gets all positional arguments converted to the given type. More... | |
Public Attributes | |
const char * | program |
Returns the name of the program from the original arguments list. This is always the first argument. More... | |
std::unordered_map < std::string, option_results > | options |
Maps from definition name to the structure which contains the parser results for that definition. More... | |
std::vector< const char * > | pos |
Vector of positional arguments. More... | |
Represents all results of the parser including options and positional arguments.
Definition at line 311 of file argagg.hpp.
std::vector< T > argagg::parser_results::all_as | ( | ) | const |
Gets all positional arguments converted to the given type.
Definition at line 797 of file argagg.hpp.
T argagg::parser_results::as | ( | std::size_t | i = 0 | ) | const |
Gets a positional argument converted to the given type.
Definition at line 790 of file argagg.hpp.
|
inline |
Gets the number of positional arguments.
Definition at line 776 of file argagg.hpp.
|
inline |
Used to check if an option was specified at all.
Definition at line 753 of file argagg.hpp.
|
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 761 of file argagg.hpp.
|
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 769 of file argagg.hpp.
|
inline |
Gets a positional argument by index.
Definition at line 783 of file argagg.hpp.
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 325 of file argagg.hpp.
std::vector<const char*> argagg::parser_results::pos |
Vector of positional arguments.
Definition at line 331 of file argagg.hpp.
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 318 of file argagg.hpp.