Argument< T > Struct Template Reference

Command line argument. More...

#include <argumentParser.h>

Inheritance diagram for Argument< T >:

Inheritance graph
[legend]
Collaboration diagram for Argument< T >:

Collaboration graph
[legend]

Public Member Functions

 Argument (T *t, char sn, string ln, string h, bool m)
 Constructor.
void printValue () const
 General case for printing default value.
 Argument (T *t, char sn, string ln, string h, bool m)
 Constructor.
void printValue () const
 Print the value of the associated variable.
template<>
bool read (std::list< std::string > &str)
template<>
bool read (std::list< std::string > &)
template<>
bool read (std::list< std::string > &str)
 Read the command line.
template<>
void printValue () const
 Print the value of the associated variable.
template<>
bool read (std::list< std::string > &)
template<>
bool read (std::list< std::string > &str)
 Read the command line.
template<>
bool read (std::list< std::string > &)
template<>
bool read (std::list< std::string > &str)
 Read the command line.

Private Member Functions

bool read (std::list< std::string > &str)
 Try to read argument value from an input stream.
bool read (std::list< std::string > &str)
 Try to read argument value from an input stream.

Private Attributes

T * ptr
 Pointer to the parameter.

Detailed Description

template<class T = void*>
struct Argument< T >

Command line argument.

Contains a pointer to a value which can be parsed by a ArgumentParser.Contains also a short name, a long name and a help message.

See also:
ArgumentParser

Definition at line 108 of file argumentParser.h.


Constructor & Destructor Documentation

template<class T = void*>
Argument< T >::Argument ( T *  t,
char  sn,
string  ln,
string  h,
bool  m 
) [inline]

Constructor.

Parameters:
t a pointer to the value
sn short name of the argument
ln long name of the argument
h help on the argument
m true iff the argument is mandatory

Definition at line 118 of file argumentParser.h.

template<class T = void*>
Argument< T >::Argument ( T *  t,
char  sn,
string  ln,
string  h,
bool  m 
) [inline]

Constructor.

Parameters:
t a pointer to the value
sn short name of the argument
ln long name of the argument
h help on the argument
m true iff the argument is mandatory

Definition at line 120 of file argumentParser.h.


Member Function Documentation

template<>
void Argument< std::vector< std::string > >::printValue (  )  const [inline, virtual]

Print the value of the associated variable.

Implements ArgumentBase.

Definition at line 209 of file ArgumentParser.h.

template<class T = void*>
void Argument< T >::printValue (  )  const [inline, virtual]

Print the value of the associated variable.

Implements ArgumentBase.

template<class T >
void Argument< T >::printValue (  )  const [inline, virtual]

General case for printing default value.

Implements ArgumentBase.

Definition at line 174 of file argumentParser.h.

References Argument< T >::ptr.

template<>
bool Argument< std::string >::read ( std::list< std::string > &  str  )  [inline, virtual]

Read the command line.

Implements ArgumentBase.

Definition at line 164 of file argumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<>
bool Argument< bool >::read ( std::list< std::string > &   )  [inline, virtual]

Booleans are seen as flags that you can set to TRUE using the command line. Example: run --verbose The advantage is that you do not have to set the value, it is automatically TRUE. The drawback is that reading a boolean necessarily sets it to TRUE. Currently you can not set a boolean to FALSE using this parser.

Implements ArgumentBase.

Definition at line 156 of file argumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<>
bool Argument< std::string >::read ( std::list< std::string > &  str  )  [inline, virtual]

Read the command line.

Implements ArgumentBase.

Definition at line 162 of file argumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<>
bool Argument< bool >::read ( std::list< std::string > &   )  [inline, virtual]

Booleans are seen as flags that you can set to TRUE using the command line. Example: run --verbose The advantage is that you do not have to set the value, it is automatically TRUE. The drawback is that reading a boolean necessarily sets it to TRUE. Currently you can not set a boolean to FALSE using this parser.

Implements ArgumentBase.

Definition at line 154 of file argumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<>
bool Argument< std::string >::read ( std::list< std::string > &  str  )  [inline, virtual]

Read the command line.

Implements ArgumentBase.

Definition at line 191 of file ArgumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<>
bool Argument< bool >::read ( std::list< std::string > &   )  [inline, virtual]

Booleans are seen as flags that you can set to TRUE using the command line. Example: run --verbose The advantage is that you do not have to set the value, it is automatically TRUE. The drawback is that reading a boolean necessarily sets it to TRUE. Currently you can not set a boolean to FALSE using this parser.

Implements ArgumentBase.

Definition at line 183 of file ArgumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<>
bool Argument< std::vector< std::string > >::read ( std::list< std::string > &  str  )  [inline, virtual]

Lists are used for options that can be repeted Example: run -D ELEM1 -D ELEM2 ...

Implements ArgumentBase.

Definition at line 166 of file ArgumentParser.h.

template<class T = void*>
bool Argument< T >::read ( std::list< std::string > &  str  )  [inline, private, virtual]

Try to read argument value from an input stream.

Return false if failed

Implements ArgumentBase.

Definition at line 135 of file argumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.

template<class T = void*>
bool Argument< T >::read ( std::list< std::string > &  str  )  [inline, private, virtual]

Try to read argument value from an input stream.

Return false if failed

Implements ArgumentBase.

Definition at line 133 of file argumentParser.h.

References ArgumentBase::isSet, and Argument< T >::ptr.


Field Documentation

template<class T = void*>
T * Argument< T >::ptr [private]

Pointer to the parameter.

Definition at line 127 of file argumentParser.h.

Referenced by Argument< T >::printValue(), and Argument< T >::read().


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

Generated on Sun Nov 23 04:12:50 2008 for Sofa by  doxygen 1.5.7.1