Global interface to command line options.
More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/commandline/CommandLineParser.h>
Global interface to command line options.
Allows to add and retrieve command line arguments. Also does the parsing.
- Note
- Internally it is a Singleton, but the public interface is static.
- See also
- CommandLineArgument
orxonox::CommandLineParser::CommandLineParser |
( |
| ) |
|
|
inline |
Constructor initialises bFirstTimeParse_ with true.
orxonox::CommandLineParser::~CommandLineParser |
( |
| ) |
|
Destructor destroys all CommandLineArguments with it.
Undefined copy constructor.
void orxonox::CommandLineParser::_parse |
( |
const std::string & |
cmdLine | ) |
|
|
private |
Parses the command line string for arguments and stores these.
- Note
- The reason that you have to provide the string to be parsed as space separated list is because of argc and argv. If you only have a whole string, simply use getAllStrings() of SubString.
- Parameters
-
cmdLine | Command line string WITHOUT the execution path. |
Adds a new CommandLineArgument to the internal map.
Note that only such arguments are actually valid.
void orxonox::CommandLineParser::checkFullArgument |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
|
private |
Parses an argument based on its full name.
- Parameters
-
name | Full name of the argument |
value | String containing the value |
void orxonox::CommandLineParser::checkShortcut |
( |
const std::string & |
shortcut, |
|
|
const std::string & |
value |
|
) |
| |
|
private |
Parses an argument based on its shortcut.
- Parameters
-
shortcut | Shortcut to the argument |
value | String containing the value |
static bool orxonox::CommandLineParser::existsArgument |
( |
const std::string & |
name | ) |
|
|
inlinestatic |
void orxonox::CommandLineParser::generateDoc |
( |
std::ofstream & |
file | ) |
|
|
static |
const CommandLineArgument * orxonox::CommandLineParser::getArgument |
( |
const std::string & |
name | ) |
|
|
static |
Retrieves a CommandLineArgument.
The method throws an exception if 'name' was not found or the value could not be converted.
- Note
- You should of course not call this method before the command line has been parsed.
std::string orxonox::CommandLineParser::getUsageInformation |
( |
| ) |
|
|
static |
template<class T >
static void orxonox::CommandLineParser::getValue |
( |
const std::string & |
name, |
|
|
T * |
value |
|
) |
| |
|
inlinestatic |
Writes the argument value in the given parameter.
static const MultiType& orxonox::CommandLineParser::getValue |
( |
const std::string & |
name | ) |
|
|
inlinestatic |
static void orxonox::CommandLineParser::parse |
( |
const std::string & |
cmdLine | ) |
|
|
inlinestatic |
Parse redirection to internal member method.
bool orxonox::CommandLineParser::bFirstTimeParse_ |
|
private |
Tells whether we parsed for the first time.
The CommmandLineArguments are added before main(). So when we call parse() the first time, we need to create a map with all shortcuts since these get added after addCommandLineArgument().
Holds all pointers to the arguments and serves as a search map by name.
Search map by shortcut for the arguments.
The documentation for this class was generated from the following files: