zeus::TArgumentParser Class Reference

#include <ArgumentParser.h>

Inheritance diagram for zeus::TArgumentParser:

zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TArgumentParser (Int iArgC, char *apArgs[])
 TArgumentParser (const IString &rInParams)
bool hasArgument (const IString &rArgName) const
bool hasArgument (const wchar_t *pArgName) const
bool hasArgumentWithValue (const IString &rArgName) const
bool hasArgumentWithValue (const wchar_t *pArgName) const
TString getArgumentValue (const IString &rArgName) const
TString getArgumentValue (const wchar_t *pArgName) const
TString getArgumentValueByIndex (Int iIndex) const
Int getArgumentCount () const
TString getApplicationFile () const
TString getApplicationMainPath () const
void resetList ()
TString getNextItem () const
bool hasNextItem () const

Protected Member Functions

virtual ~TArgumentParser ()

Protected Attributes

TStringMap< TStringm_mapItems
 Map of all parsed name-value pairs.
TStringList m_lstItems
 List of items to check the order.
TString m_strFileName
 Application file name.


Detailed Description

The argument parser parses the input parameters of an application (command line parameters). It groups them into param=value pairs.

Constructor & Destructor Documentation

TArgumentParser::TArgumentParser ( Int  iArgC,
char *  apArgs[] 
)

Creates an argument parser. The arguments are stored in a char* array. This constructor is normaly used to parse arguments from an application

Parameters:
iArgC : Number of arguments
apArgs,: Array of arguments

TArgumentParser::TArgumentParser ( const IString rInParams  ) 

Creates an argument parser. The arguments are passed as a string. Note that the delimiter is a simple space

Parameters:
rInParams : String containing all arguments (space seperated)

TArgumentParser::~TArgumentParser (  )  [protected, virtual]

Destroys the argument parser


Member Function Documentation

bool zeus::TArgumentParser::hasArgument ( const IString rArgName  )  const [inline]

checks if an argument has been passed.

Parameters:
rArgName : Name of the argument
Return values:
true : Argument has been passed
false : No such argument found

bool zeus::TArgumentParser::hasArgument ( const wchar_t *  pArgName  )  const [inline]

checks if an argument has been passed.

Parameters:
pArgName : Name of the argument
Return values:
true : Argument has been passed
false : No such argument found

bool zeus::TArgumentParser::hasArgumentWithValue ( const IString rArgName  )  const [inline]

checks if an argument has been passed with a non empty value.

Parameters:
pArgName : Name of the argument
Return values:
true : Argument has been passed
false : No such argument found

bool zeus::TArgumentParser::hasArgumentWithValue ( const wchar_t *  pArgName  )  const [inline]

checks if an argument has been passed with a non empty value.

Parameters:
pArgName : Name of the argument
Return values:
true : Argument has been passed
false : No such argument found

TString zeus::TArgumentParser::getArgumentValue ( const IString rArgName  )  const [inline]

Returns the argument value if available

Parameters:
rArgName : Name of the argument
Returns:
Argument value

TString zeus::TArgumentParser::getArgumentValue ( const wchar_t *  pArgName  )  const [inline]

Returns the argument value if available

Parameters:
pArgName : Name of the argument
Returns:
Argument value

TString zeus::TArgumentParser::getArgumentValueByIndex ( Int  iIndex  )  const [inline]

Returns the argument value by index

Parameters:
iIndex : Index of the argument
Returns:
Argument value

Int zeus::TArgumentParser::getArgumentCount (  )  const [inline]

Returns the number of arguments

TString zeus::TArgumentParser::getApplicationFile (  )  const [inline]

Returns the file name of the application

TString TArgumentParser::getApplicationMainPath (  )  const

Returns the path of the application

void zeus::TArgumentParser::resetList (  )  [inline]

Resets the iterator

TString zeus::TArgumentParser::getNextItem (  )  const [inline]

returns the next argument name of the list

bool zeus::TArgumentParser::hasNextItem (  )  const [inline]

checks if there are more arguments


Member Data Documentation

Map of all parsed name-value pairs.

List of items to check the order.

Application file name.


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


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Wed Oct 28 21:42:33 2009