#include <conf.hh>
Public Types | |
typedef std::map< unsigned char, int > | ShortMap |
A type for mapping short option names to option indices. | |
typedef std::map< std::string, int > | LongMap |
A type for mapping long option names to option indices. | |
Public Member Functions | |
Config () | |
Create an empty config. | |
Config & | operator() (std::string usage) |
Add a usage line for the help screen. | |
Config & | operator() (unsigned char short_name, std::string long_name, std::string type="", std::string default_value="", std::string help="") |
Add a new option. | |
void | parse (int argc, char *argv[], bool override=true) |
Parse command line arguments. | |
void | default_parse (int argc, char *argv[]) |
Default parsing with "help" option. | |
void | check_required () const |
Check if all required options are specified. | |
void | print_help (FILE *file=stdout, int exit_value=0) const |
Prints usage information. | |
std::string | help_string () const |
Returns the usage information. | |
const Option & | operator[] (unsigned char short_name) const |
Get a value of an option. | |
const Option & | operator[] (std::string long_name) const |
Get a value of an option. | |
Public Attributes | |
std::string | usage_line |
Usage line printed in help if specified. | |
std::vector< Option > | options |
Options added to the configuration. | |
ShortMap | short_map |
Mapping short names to options. | |
LongMap | long_map |
Mapping long names to options. | |
std::vector< std::string > | arguments |
Rest of the non-option arguments. | |
int | longest_name_length |
The length of the longest long name. | |
Private Member Functions | |
void | parse_aux (std::deque< std::string > &argument_queue, bool override) |
The actual parsing of command line (or config file) options. |
|
A type for mapping long option names to option indices.
|
|
A type for mapping short option names to option indices.
|
|
Create an empty config.
|
|
Check if all required options are specified.
|
|
Default parsing with "help" option.
|
|
Returns the usage information.
|
|
Add a new option.
|
|
Add a usage line for the help screen.
|
|
Get a value of an option.
|
|
Get a value of an option.
|
|
Parse command line arguments.
|
|
The actual parsing of command line (or config file) options.
|
|
Prints usage information.
|
|
Rest of the non-option arguments.
|
|
Mapping long names to options.
|
|
The length of the longest long name.
|
|
Options added to the configuration.
|
|
Mapping short names to options.
|
|
Usage line printed in help if specified.
|