OpenDaVINCI  4.15.3
odcore::base::CommandLineParser Class Reference

#include <CommandLineParser.h>

Public Member Functions

 CommandLineParser ()
 
virtual ~CommandLineParser ()
 
void addCommandLineArgument (const string &argument)
 
void parse (const int32_t &argc, char **argv)
 
const CommandLineArgument getCommandLineArgument (const string &argument) throw (exceptions::CommandLineParserException)
 
const vector< CommandLineArgumentgetCommandLineArguments (const string &argument)
 

Protected Attributes

vector< string > m_listOfArgumentsToParse
 
map< string, vector
< CommandLineArgument > > 
m_values
 

Detailed Description

The command line parser parses the command line used to start a module. Possible command line arguments can be set before parsing and accessed later.

Constructor & Destructor Documentation

odcore::base::CommandLineParser::CommandLineParser ( )
odcore::base::CommandLineParser::~CommandLineParser ( )
virtual

Member Function Documentation

void odcore::base::CommandLineParser::addCommandLineArgument ( const string &  argument)

Adds a new argument of the form "--argument=..." to the command line parser.

Parameters
argumentArgument to be added to the parser.

References m_listOfArgumentsToParse.

Referenced by odcontext::base::CommandLineInterface::parse().

const CommandLineArgument odcore::base::CommandLineParser::getCommandLineArgument ( const string &  argument)
throw (exceptions::CommandLineParserException
)

Returns a CommandLineArgument containing information about the specified argument.

Parameters
argumentCommand line argument to be queried.
Returns
Value for the queried argument.

References OPENDAVINCI_CORE_THROW_EXCEPTION.

Referenced by odcontext::base::CommandLineInterface::parse().

const vector< CommandLineArgument > odcore::base::CommandLineParser::getCommandLineArguments ( const string &  argument)

Returns a list of CommandLineArgument containing information about the specified argument.

Parameters
argumentCommand line argument to be queried.
Returns
List of values for the queried argument.

References m_values.

void odcore::base::CommandLineParser::parse ( const int32_t &  argc,
char **  argv 
)

Parses the command line. The first argument is skipped because it contains the path to the executable.

Parameters
argcNumber of arguments.
argvArguments.

References m_listOfArgumentsToParse, and m_values.

Referenced by odcontext::base::CommandLineInterface::parse().

Member Data Documentation

vector<string> odcore::base::CommandLineParser::m_listOfArgumentsToParse
protected

Referenced by addCommandLineArgument(), and parse().

map<string, vector<CommandLineArgument> > odcore::base::CommandLineParser::m_values
protected

Referenced by getCommandLineArguments(), and parse().