![]() |
Computer Assited Medical Intervention Tool Kit
|
Easy management of command line. More...
#include <CommandLineParser.h>
Public Member Functions | |
void | addOption (std::string optionName, std::string description) |
add an option (use –optionName on the command line to activate it) | |
CommandLineParser (int argc, char *argv[]) | |
default constructor | |
std::vector< std::string > & | getRemainingArguments () |
get the remaining parameters (useful to open files by giving their names on the command line) | |
void | help () |
print help (but do not exit the application) | |
bool | option (std::string) |
check for option | |
void | parse () |
parse command line and exit if application was call with help or version arguments or if an parsing error occurs | |
void | setDescription (std::string description) |
set help string | |
void | version () |
print version (but do not exit the application) | |
virtual | ~CommandLineParser () |
destructor |
Private Attributes | |
std::vector< std::string > | arguments |
argv given from command line | |
std::string | description |
the usage/help message | |
std::string | name |
application name | |
std::map< std::string, std::string > | options |
list of all options+description | |
std::vector< std::string > | remainingArguments |
position of remaining parameters (arguments) |
Easy management of command line.
By default –help displays the usage and –version displays the version.
CommandLineParser::CommandLineParser | ( | int | argc, |
char * | argv[] | ||
) |
default constructor
|
inlinevirtual |
destructor
void CommandLineParser::addOption | ( | std::string | optionName, |
std::string | description | ||
) |
add an option (use –optionName on the command line to activate it)
Referenced by main().
std::vector< std::string > & CommandLineParser::getRemainingArguments | ( | ) |
get the remaining parameters (useful to open files by giving their names on the command line)
Referenced by main().
void CommandLineParser::help | ( | ) |
print help (but do not exit the application)
References description, and camitk::Core::version.
bool CommandLineParser::option | ( | std::string | option | ) |
check for option
Referenced by main().
void CommandLineParser::parse | ( | ) |
parse command line and exit if application was call with help or version arguments or if an parsing error occurs
Referenced by main().
void CommandLineParser::setDescription | ( | std::string | description | ) |
void CommandLineParser::version | ( | ) |
print version (but do not exit the application)
References camitk::Core::version.
|
private |
argv given from command line
|
private |
the usage/help message
|
private |
application name
|
private |
list of all options+description
|
private |
position of remaining parameters (arguments)