ArgumentParser Class Reference

Generic command-line arguments parser. More...

#include <ArgumentParser.h>

Inheritance diagram for ArgumentParser:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::vector< std::string > StringContainer

Public Member Functions

 ArgumentParser ()
virtual ~ArgumentParser ()
bool parseArguments (int argc, char **argv)
char * getCstringValue (std::string name)
void setDescription (const char *description)
void setVersion (const char *version)
template<class T>
getValue (std::string name)
void clean ()

Protected Member Functions

virtual void showHelp (bool quit=true, const char *custMessage=0)
virtual void showHelpAppendix ()=0
void showError (StringContainer parts)
void showError (const char *message)
void showVersion (bool quit=false)
void setDelimiter (const char *new_var)
char * getDelimiter ()
void addArgument (const char *name, const char *description, bool required, const char *def)

Detailed Description

Generic command-line arguments parser.

Definition at line 21 of file ArgumentParser.h.


Member Typedef Documentation

typedef std::vector<std::string> ArgumentParser::StringContainer

Definition at line 25 of file ArgumentParser.h.


Constructor & Destructor Documentation

ArgumentParser::ArgumentParser (  ) 

Empty Constructor

virtual ArgumentParser::~ArgumentParser (  )  [virtual]

Empty Destructor


Member Function Documentation

bool ArgumentParser::parseArguments ( int  argc,
char **  argv 
)

Parse command line arguments

Returns:
bool
Parameters:
argc Argument count
argv Array of arguments.

char* ArgumentParser::getCstringValue ( std::string  name  ) 

Return char*

Returns:
char*
Parameters:
name Argument name

void ArgumentParser::setDescription ( const char *  description  ) 

Set program description

Parameters:
description Program description

void ArgumentParser::setVersion ( const char *  version  ) 

Set program version

Parameters:
version String describing program version

template<class T>
T ArgumentParser::getValue ( std::string  name  )  [inline]

Template for prasing cstrings.

Returns:
T
Parameters:
name Argument name.

Definition at line 69 of file ArgumentParser.h.

References showHelp().

void ArgumentParser::clean (  ) 

Free malloced memory.

virtual void ArgumentParser::showHelp ( bool  quit = true,
const char *  custMessage = 0 
) [protected, virtual]

Show help

Parameters:
quit if is true then function call exit(0) on end
custMessage Custom message to show on the top of help

Referenced by getValue().

virtual void ArgumentParser::showHelpAppendix (  )  [protected, pure virtual]

This method is called after help is showed.

void ArgumentParser::showError ( StringContainer  parts  )  [protected]

Show help message and quit

Parameters:
parts vector containing parts of error message

void ArgumentParser::showError ( const char *  message  )  [protected]

Show help message and quit

Parameters:
message error message

void ArgumentParser::showVersion ( bool  quit = false  )  [protected]

Show version

Parameters:
quit if is true then function call exit(1) on end

void ArgumentParser::setDelimiter ( const char *  new_var  )  [protected]

Set the value of delimiter_ Arguments delimiter.

Parameters:
new_var the new value of m_delimiter_

char* ArgumentParser::getDelimiter (  )  [protected]

Get the value of delimiter_ Arguments delimiter.

Returns:
the value of m_delimiter_

void ArgumentParser::addArgument ( const char *  name,
const char *  description,
bool  required,
const char *  def 
) [protected]

Add argument

Parameters:
name Argument name
description Argument description
required True if argument is required
def Default value like cstring ( char* )


The documentation for this class was generated from the following file:
Generated on Thu Dec 6 19:33:11 2007 for Radiosity Renderer and Visualizer by  doxygen 1.5.2