CommandLineArgumentWrapper Class Reference

#include <CommandLineArguments.h>

Collaboration diagram for CommandLineArgumentWrapper:

List of all members.


Public Member Functions

 CommandLineArgumentWrapper (int argc, char **argv)
virtual ~CommandLineArgumentWrapper ()
int getNumberOfArguments () const
std::string getArgument (int index) const
bool containOption (std::string key) const
std::string getOptionValue (std::string key) const
CommandLineArguments getCommandLineArguments () const

Private Member Functions

void parseArguments (int argc, char **argv)
void parseOption (std::string argument)

Private Attributes

CommandLineArguments originalArguments
std::vector< std::string > argumentList
std::map< std::string,
std::string > 
optionMap

Constructor & Destructor Documentation

CommandLineArgumentWrapper::CommandLineArgumentWrapper ( int  argc,
char **  argv 
)

Parses the passed command line arguments and stores the values internally. The class therefore parses the command line strings for options (beginning with a -) and normal arguments. Options are stored in the options list while normal arguments are stored in the argument list. The positioning of options in the arguments is not restricted, so options can be placed in front, at the end or in between standard arguments. The application command itself is kept in the arguments to be compatible to the usual command line argument indices.

CommandLineArgumentWrapper::~CommandLineArgumentWrapper (  )  [virtual]

Cleans up the arguments and options


Member Function Documentation

bool CommandLineArgumentWrapper::containOption ( std::string  key  )  const

Returns if the option was passed via the command line.

string CommandLineArgumentWrapper::getArgument ( int  index  )  const

Returns the command line argument at the passed index.

CommandLineArguments CommandLineArgumentWrapper::getCommandLineArguments (  )  const

Returns the original command line (including options)

int CommandLineArgumentWrapper::getNumberOfArguments (  )  const

Returns the number of arguments from the command line.

std::string CommandLineArgumentWrapper::getOptionValue ( std::string  key  )  const

Returns the value of a command line option if existing

void CommandLineArgumentWrapper::parseArguments ( int  argc,
char **  argv 
) [private]

Parses the passed arguments and fills the object (see constructor)

void CommandLineArgumentWrapper::parseOption ( std::string  argument  )  [private]

Searches in the passed argument if the option has a value (assignment) and stores the option and its value (if existing) in the optionMap


Member Data Documentation

std::vector<std::string> CommandLineArgumentWrapper::argumentList [private]

std::map<std::string, std::string> CommandLineArgumentWrapper::optionMap [private]


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

Generated on Wed Oct 20 16:11:55 2010 for inVRs by doxygen 1.5.8