argagg
 All Classes Namespaces Files Functions Variables Macros Pages
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. More...
 
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(). More...
 
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(). 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 >
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...
 

Detailed Description

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

Definition at line 311 of file argagg.hpp.

Member Function Documentation

template<typename T >
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.

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 790 of file argagg.hpp.

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

Gets the number of positional arguments.

Definition at line 776 of file argagg.hpp.

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 753 of file argagg.hpp.

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 761 of file argagg.hpp.

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 769 of file argagg.hpp.

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

Gets a positional argument by index.

Definition at line 783 of file argagg.hpp.

Member Data Documentation

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.


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