Graph Framework
Loading...
Searching...
No Matches
commandline::parser Class Reference

Parser class. More...

#include <commandline_parser.hpp>

Public Member Functions

 parser (const char *name)
 Default constructor.
 
void add_option (const std::string &option, const bool takes_value, const std::string &help_text, const std::set< std::string > &values={})
 Add commandline option.
 
void show_help (const std::string &command) const
 Display help.
 
void parse (const int argc, const char *argv[])
 Parse the command line.
 
bool is_option_set (const std::string &option) const
 Check if option is set.
 
template<typename T >
get_option_value (const std::string &option) const
 Get the option value.
 

Detailed Description

Parser class.

Member Function Documentation

◆ add_option()

void commandline::parser::add_option ( const std::string &  option,
const bool  takes_value,
const std::string &  help_text,
const std::set< std::string > &  values = {} 
)
inline

Add commandline option.

Parameters
[in]optionThe command option.
[in]takes_valueFlag to indicate the option takes a value.
[in]help_textThe help text of the option.
[in]valuesAn optional set of values.

◆ get_option_value()

template<typename T >
T commandline::parser::get_option_value ( const std::string &  option) const
inline

Get the option value.

Template Parameters
TType of the value.

◆ is_option_set()

bool commandline::parser::is_option_set ( const std::string &  option) const
inline

Check if option is set.

Parameters
[in]optionThe option to check.

◆ parse()

void commandline::parser::parse ( const int  argc,
const char *  argv[] 
)
inline

Parse the command line.

Parameters
[in]argcNumber of commandline arguments.
[in]argvArray of commandline arguments.

◆ show_help()

void commandline::parser::show_help ( const std::string &  command) const
inline

Display help.

Parameters
[in]commandName of the program.

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