Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::Util::CommandLine::Parameter< T > Class Template Reference

#include <parsecl.hpp>

Inheritance diagram for Arak::Util::CommandLine::Parameter< T >:

Inheritance graph
[legend]
Collaboration diagram for Arak::Util::CommandLine::Parameter< T >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class T>
class Arak::Util::CommandLine::Parameter< T >

A parameter that has a default value and may be overridden on the command line.

Definition at line 142 of file parsecl.hpp.

Public Member Functions

 Parameter (const char *sflag, const char *lflag, const char *desc, const T &def, bool required=false)
 Constructor.

virtual ~Parameter ()
 Destructor.

const T & value () const
 Returns the value of this parameter.

virtual bool hasArg ()
 Returns true if this option takes an argument.


Protected Member Functions

virtual bool read (const char *str)
 Reads the value of this parameter from the supplied string.


Private Member Functions

virtual void printUsage (std::ostream &out) const
 Prints the usage of this parameter to the supplied output stream.


Private Attributes

val
 The value of this parameter.


Friends

class CommandLine


Constructor & Destructor Documentation

template<class T>
Arak::Util::CommandLine::Parameter< T >::Parameter const char *  sflag,
const char *  lflag,
const char *  desc,
const T &  def,
bool  required = false
[inline]
 

Constructor.

Parameters:
sflag The short form of the option. This is usually preceded by a single dash and consists of a single letter, as in "-h".
lflag The long form of the option. This is usually preceded by a double dash, as in "--help".
desc A description of the option. This should be a string with no formatting (e.g., no newlines).
def The default value of the parameter.
required true if this option is required

Definition at line 198 of file parsecl.hpp.

References Arak::Util::CommandLine::Parameter< T >::val.

template<class T>
virtual Arak::Util::CommandLine::Parameter< T >::~Parameter  )  [inline, virtual]
 

Destructor.

Definition at line 208 of file parsecl.hpp.


Member Function Documentation

template<class T>
virtual bool Arak::Util::CommandLine::Parameter< T >::hasArg  )  [inline, virtual]
 

Returns true if this option takes an argument.

Reimplemented from Arak::Util::CommandLine::Option.

Definition at line 218 of file parsecl.hpp.

template<class T>
virtual void Arak::Util::CommandLine::Parameter< T >::printUsage std::ostream &  out  )  const [inline, private, virtual]
 

Prints the usage of this parameter to the supplied output stream.

Reimplemented from Arak::Util::CommandLine::Option.

Definition at line 157 of file parsecl.hpp.

References Arak::Util::CommandLine::Parameter< T >::val.

template<class T>
virtual bool Arak::Util::CommandLine::Parameter< T >::read const char *  str  )  [inline, protected, virtual]
 

Reads the value of this parameter from the supplied string.

Parameters:
str a string representation of this parameter's value
Returns:
true if the read was successful

Reimplemented from Arak::Util::CommandLine::Option.

Definition at line 173 of file parsecl.hpp.

References Arak::Util::CommandLine::Parameter< T >::val.

template<class T>
const T& Arak::Util::CommandLine::Parameter< T >::value  )  const [inline]
 

Returns the value of this parameter.

Definition at line 213 of file parsecl.hpp.

References Arak::Util::CommandLine::Parameter< T >::val.


Friends And Related Function Documentation

template<class T>
friend class CommandLine [friend]
 

Reimplemented from Arak::Util::CommandLine::Option.

Definition at line 144 of file parsecl.hpp.


Member Data Documentation

template<class T>
T Arak::Util::CommandLine::Parameter< T >::val [private]
 

The value of this parameter.

Definition at line 151 of file parsecl.hpp.

Referenced by Arak::Util::CommandLine::Parameter< T >::Parameter(), Arak::Util::CommandLine::Parameter< T >::printUsage(), Arak::Util::CommandLine::Parameter< T >::read(), and Arak::Util::CommandLine::Parameter< T >::value().


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:41:41 2005 for Arak by doxygen 1.3.6