Option< T > Struct Template Reference

#include <Options.h>

Inheritance diagram for Option< T >:

OptionBase

Detailed Description

template<typename T>
struct Option< T >

Class template for command line options.
Examples:

createAddresses.cxx, createConfigs.cxx, createParams.cxx, createPriority.cxx, createTables.cxx, createValues.cxx, dropTables.cxx, and rcuconf.cxx.

Definition at line 144 of file Options.h.

Public Member Functions

 Option (char s, const char *l, const char *h, const T &v=T(), bool arg=true)
bool Handle (char s, const char *arg)
bool Handle (const std::string &l, const std::string &arg)
const T & Value () const
void Help () const
const T * operator-> () const
 operator const T & () const
Option< T > & operator= (const T &v)


Constructor & Destructor Documentation

template<typename T>
Option< T >::Option char  s,
const char *  l,
const char *  h,
const T &  v = T(),
bool  arg = true
[inline]
 

Option constructor.

Parameters:
s Short option
l Long option
h Help string
v Default value
arg Whether we need and argument.

Definition at line 152 of file Options.h.


Member Function Documentation

template<typename T>
bool Option< T >::Handle const std::string &  l,
const std::string &  arg
[inline, virtual]
 

Handle an option.

If the option matches, decode the value if needed and return true.

Parameters:
l Long option string
arg argument to possibly decode to value
Returns:
true if we handled this option

Implements OptionBase.

Definition at line 179 of file Options.h.

template<typename T>
bool Option< T >::Handle char  s,
const char *  arg
[inline, virtual]
 

Handle an option.

If the option matches, decode the value if needed and return true.

Parameters:
s Short option character
arg argument to possibly decode to value
Returns:
true if we handled this option

Implements OptionBase.

Definition at line 161 of file Options.h.

template<typename T>
void Option< T >::Help  )  const [inline, virtual]
 

Print help information.

Reimplemented from OptionBase.

Definition at line 194 of file Options.h.

References OptionBase::Help(), OptionBase::IsSet(), and OptionBase::NeedArg().

template<typename T>
Option< T >::operator const T &  )  const [inline]
 

Conversion operator.

Returns:
This option as value type

Definition at line 209 of file Options.h.

template<typename T>
const T* Option< T >::operator->  )  const [inline]
 

Pointer operator to get pointer to underlyinig object.

Returns:
Pointer to value object

Definition at line 206 of file Options.h.

template<typename T>
Option<T>& Option< T >::operator= const T &  v  )  [inline]
 

Assignment operator.

Parameters:
v Value to assign.
Returns:
reference to this object

Definition at line 213 of file Options.h.

template<typename T>
const T& Option< T >::Value  )  const [inline]
 

Returns:
The current value
Examples:
createConfigs.cxx.

Definition at line 192 of file Options.h.


The documentation for this struct was generated from the following file:
Top of page Last update Fri Apr 27 01:54:16 2007
Copyright © 2004 Christian Holm Created by DoxyGen 1.3.5