Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
limbo::programoptions::Value< T > Class Template Reference

a generic class for various data values More...

#include <ProgramOptions.h>

Inheritance diagram for limbo::programoptions::Value< T >:
limbo::programoptions::ValueBase

Public Types

typedef T value_type
 data type
 
typedef ValueBase base_type
 base type
 

Public Member Functions

 Value (std::string const &cat, value_type *target, std::string const &m)
 constructor More...
 
 Value (Value const &rhs)
 copy constructor More...
 
Valueoperator= (Value const &rhs)
 assignment More...
 
virtual ~Value ()
 destructor
 
virtual bool parse (const char *v)
 parse data from string More...
 
virtual void print (std::ostream &os) const
 print target value More...
 
virtual void print_default (std::ostream &os) const
 print default value More...
 
virtual void apply_default ()
 apply default value
 
virtual void apply_toggle ()
 apply toggle value
 
virtual bool valid_target () const
 check whether target value is valid More...
 
virtual bool valid_default () const
 check whether default value is valid More...
 
virtual bool valid_toggle () const
 check whether toggle value is valid More...
 
virtual unsigned count_default_chars () const
 count the length of default value string More...
 
virtual bool help_on () const
 check whether help message is turned on More...
 
virtual Valuedefault_value (value_type const &v, std::string const &d="")
 set default value More...
 
virtual Valuetoggle_value (value_type const &v)
 set toggle value More...
 
virtual Valuehelp (bool h)
 set help flag More...
 
virtual Valuerequired (bool r)
 set required flag More...
 
virtual Valuetoggle (bool t)
 set toggle flag More...
 
- Public Member Functions inherited from limbo::programoptions::ValueBase
 ValueBase (std::string const &cat, std::string const &m)
 constructor More...
 
 ValueBase (ValueBase const &rhs)
 copy constructor More...
 
ValueBaseoperator= (ValueBase const &rhs)
 assignment More...
 
virtual ~ValueBase ()
 destructor
 
std::string const & category () const
 
std::string const & msg () const
 
bool help () const
 
bool required () const
 
bool valid () const
 
bool toggle () const
 
void print_category (std::ostream &os) const
 print category More...
 
void print_msg (std::ostream &os) const
 print message More...
 

Protected Member Functions

void copy (Value const &rhs)
 copy another object More...
 
- Protected Member Functions inherited from limbo::programoptions::ValueBase
void copy (ValueBase const &rhs)
 copy another object More...
 

Protected Attributes

value_typem_target
 NULL for help.
 
value_typem_default_value
 default value
 
value_typem_toggle_value
 only valid when this option is a toggle value
 
std::string m_default_display
 display default value
 
- Protected Attributes inherited from limbo::programoptions::ValueBase
std::string m_category
 category
 
std::string m_msg
 helper message
 
unsigned char m_help: 1
 whether is help option
 
unsigned char m_required: 1
 whether the value is a required option
 
unsigned char m_valid: 1
 true if target is set, not default
 
unsigned char m_toggle: 1
 true if this option is a toggle value
 

Detailed Description

template<typename T>
class limbo::programoptions::Value< T >

a generic class for various data values

Template Parameters
Tdata type

Definition at line 217 of file ProgramOptions.h.

Constructor & Destructor Documentation

template<typename T >
limbo::programoptions::Value< T >::Value ( std::string const &  cat,
value_type target,
std::string const &  m 
)
inline

constructor

Parameters
catcategory
targeta pointer of target
mmessage

Definition at line 231 of file ProgramOptions.h.

template<typename T >
limbo::programoptions::Value< T >::Value ( Value< T > const &  rhs)
inline

copy constructor

Parameters
rhsthe other object

Definition at line 242 of file ProgramOptions.h.

Member Function Documentation

template<typename T >
void limbo::programoptions::Value< T >::copy ( Value< T > const &  rhs)
inlineprotected

copy another object

Parameters
rhsanother object

Definition at line 436 of file ProgramOptions.h.

template<typename T >
virtual unsigned limbo::programoptions::Value< T >::count_default_chars ( ) const
inlinevirtual

count the length of default value string

Returns
the length of string if default value is printed

Implements limbo::programoptions::ValueBase.

Definition at line 357 of file ProgramOptions.h.

template<typename T >
virtual Value& limbo::programoptions::Value< T >::default_value ( value_type const &  v,
std::string const &  d = "" 
)
inlinevirtual

set default value

Parameters
vvalue
da string to display the value
Returns
reference to the object

Definition at line 380 of file ProgramOptions.h.

template<typename T >
virtual Value& limbo::programoptions::Value< T >::help ( bool  h)
inlinevirtual

set help flag

Parameters
hvalue
Returns
reference to the object

Definition at line 405 of file ProgramOptions.h.

template<typename T >
virtual bool limbo::programoptions::Value< T >::help_on ( ) const
inlinevirtual

check whether help message is turned on

Returns
true if this option is a help option and it is on

Implements limbo::programoptions::ValueBase.

Definition at line 367 of file ProgramOptions.h.

template<typename T >
Value& limbo::programoptions::Value< T >::operator= ( Value< T > const &  rhs)
inline

assignment

Parameters
rhsthe other object
Returns
reference to the object

Definition at line 252 of file ProgramOptions.h.

template<typename T >
virtual bool limbo::programoptions::Value< T >::parse ( const char *  v)
inlinevirtual

parse data from string

Parameters
vdata value in string
Returns
true if parsing is succeeded

Implements limbo::programoptions::ValueBase.

Definition at line 277 of file ProgramOptions.h.

template<typename T >
virtual void limbo::programoptions::Value< T >::print ( std::ostream &  os) const
inlinevirtual

print target value

Parameters
osoutput stream

Implements limbo::programoptions::ValueBase.

Definition at line 292 of file ProgramOptions.h.

template<typename T >
virtual void limbo::programoptions::Value< T >::print_default ( std::ostream &  os) const
inlinevirtual

print default value

Parameters
osoutput stream

Implements limbo::programoptions::ValueBase.

Definition at line 301 of file ProgramOptions.h.

template<typename T >
virtual Value& limbo::programoptions::Value< T >::required ( bool  r)
inlinevirtual

set required flag

Parameters
rvalue
Returns
reference to the object

Definition at line 415 of file ProgramOptions.h.

template<typename T >
virtual Value& limbo::programoptions::Value< T >::toggle ( bool  t)
inlinevirtual

set toggle flag

Parameters
tvalue
Returns
reference to the object

Definition at line 425 of file ProgramOptions.h.

template<typename T >
virtual Value& limbo::programoptions::Value< T >::toggle_value ( value_type const &  v)
inlinevirtual

set toggle value

Parameters
vvalue
Returns
reference to the object

Definition at line 393 of file ProgramOptions.h.

template<typename T >
virtual bool limbo::programoptions::Value< T >::valid_default ( ) const
inlinevirtual

check whether default value is valid

Returns
true if default pointer is defined

Implements limbo::programoptions::ValueBase.

Definition at line 341 of file ProgramOptions.h.

template<typename T >
virtual bool limbo::programoptions::Value< T >::valid_target ( ) const
inlinevirtual

check whether target value is valid

Returns
true if target pointer is defined

Implements limbo::programoptions::ValueBase.

Definition at line 333 of file ProgramOptions.h.

template<typename T >
virtual bool limbo::programoptions::Value< T >::valid_toggle ( ) const
inlinevirtual

check whether toggle value is valid

Returns
true if toggle pointer is defined

Implements limbo::programoptions::ValueBase.

Definition at line 349 of file ProgramOptions.h.


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