Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::option::ValueOption< T > Class Template Reference

#include <elm/option/ValueOption.h>

+ Inheritance diagram for elm::option::ValueOption< T >:

Classes

class  Make
 

Public Member Functions

 ValueOption (void)
 
 ValueOption (const Make &make)
 
 ValueOption (Manager &man, int tag...)
 
 ValueOption (Manager &man, int tag, VarArg &args)
 
 ValueOption (Manager &man, char s, cstring desc, cstring adesc, const T &val=type_info< T >::null)
 
 ValueOption (Manager &man, cstring l, cstring desc, cstring adesc, const T &_val=type_info< T >::null)
 
 ValueOption (Manager &man, char s, cstring l, cstring desc, cstring adesc, const T &_val=type_info< T >::null)
 
const T & get (void) const
 
void set (const T &value)
 
 operator const T & (void) const
 
ValueOption< T > & operator= (const T &value)
 
const T & operator* (void) const
 
 operator bool (void) const
 
virtual void process (String arg)
 
const T & value (void) const
 
template<>
 ValueOption (Manager &man, char s, cstring desc, cstring adesc, const string &value)
 
template<>
 ValueOption (Manager &man, cstring l, cstring desc, cstring adesc, const string &val)
 
template<>
 ValueOption (Manager &man, char s, cstring l, cstring desc, cstring adesc, const string &val)
 
template<>
string get (VarArg &args)
 
- Public Member Functions inherited from elm::option::AbstractValueOption
 AbstractValueOption (const Make &make)
 
 AbstractValueOption (Manager &man)
 
 AbstractValueOption (Manager &man, int tag,...)
 
 AbstractValueOption (Manager &man, int tag, VarArg &args)
 
virtual cstring description (void)
 
virtual usage_t usage (void)
 
virtual cstring argDescription (void)
 
- Public Member Functions inherited from elm::option::Option
 Option (void)
 
 Option (const Make &make)
 
virtual ~Option (void)
 
void output (io::Output &out)
 
virtual char shortName (void)
 
virtual CString longName (void)
 

Protected Member Functions

virtual void configure (Manager &manager, int tag, VarArg &args)
 
- Protected Member Functions inherited from elm::option::Option
void init (Manager &manager, int tag,...)
 
void init (Manager &manager, int tag, VarArg &args)
 

Additional Inherited Members

- Protected Attributes inherited from elm::option::Option
cstring desc
 

Detailed Description

template<class T>
class elm::option::ValueOption< T >

A generic option template for option receiving an argument. It only requires to implement the process() virtual function.

Parameters
TType of value of the argument.

Constructor & Destructor Documentation

template<class T>
elm::option::ValueOption< T >::ValueOption ( void  )
template<class T>
elm::option::ValueOption< T >::ValueOption ( const Make make)
template<class T>
elm::option::ValueOption< T >::ValueOption ( Manager man,
int  tag... 
)
template<class T>
elm::option::ValueOption< T >::ValueOption ( Manager man,
int  tag,
VarArg args 
)
template<class T>
elm::option::ValueOption< T >::ValueOption ( Manager manager,
char  short_name,
cstring  description,
cstring  arg_description,
const T &  value = type_info<T>::null 
)

Build a function with only a short name.

Parameters
managerOwner option manager
short_nameSingle letter name accessible with simple '-'.
descriptionDescription of the option.
arg_descriptionArgument description in option display.
valueDefault value of the option.
template<class T>
elm::option::ValueOption< T >::ValueOption ( Manager manager,
cstring  l,
cstring  desc,
cstring  adesc,
const T &  value = type_info<T>::null 
)

Build a function with only a long name.

Parameters
managerOwner option manager
long_nameMultiple letter name accessible with '–'.
descriptionDescription of the option.
arg_descriptionArgument description in option display.
valueDefault value of the option.
template<class T>
elm::option::ValueOption< T >::ValueOption ( Manager manager,
char  short_name,
cstring  l,
cstring  desc,
cstring  adesc,
const T &  value = type_info<T>::null 
)

Build a function with a short name and a long name.

Parameters
managerOwner option manager
short_nameSingle letter name accessible with simple '-'.
long_nameMultiple letter name accessible with '–'.
descriptionDescription of the option.
arg_descriptionArgument description in option display.
valueDefault value of the option.

Member Function Documentation

template<class T>
virtual void elm::option::ValueOption< T >::configure ( Manager manager,
int  tag,
VarArg args 
)
protectedvirtual

Handle a configuration tag and its value. May be override for extending the Option class but do no forget to call back the original configure() method.

Parameters
managerOwner manager.
tagCurrent tag.
argsList of arguments.

Reimplemented from elm::option::AbstractValueOption.

template<class T>
const T & elm::option::ValueOption< T >::get ( void  ) const

Get the argument value of the option.

Returns
Argument value.
template<>
string elm::option::ValueOption< string >::get ( VarArg args)

References elm::VarArg::next().

template<class T>
elm::option::ValueOption< T >::operator bool ( void  ) const
template<class T>
elm::option::ValueOption< T >::operator const T & ( void  ) const
template<class T>
const T & elm::option::ValueOption< T >::operator* ( void  ) const

Same as get().

template<class T>
ValueOption< T > & elm::option::ValueOption< T >::operator= ( const T &  value)

Same as set().

template<class T>
virtual void elm::option::ValueOption< T >::process ( String  arg)
virtual

This method is called by the option manager when the option is encountered.

Parameters
argIf the option requires an argument, the value of the argument.

Implements elm::option::Option.

Reimplemented in elm::option::IntOption.

template<class T>
void elm::option::ValueOption< T >::set ( const T &  value)

Set the value of the option argument.

Parameters
valueValue to set.

Referenced by elm::option::ValueOption< string >::operator=().

template<class T>
const T& elm::option::ValueOption< T >::value ( void  ) const

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