Limbo 3.5.4
Loading...
Searching...
No Matches
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
 Value (Value const &rhs)
 copy constructor
Valueoperator= (Value const &rhs)
 assignment
virtual ~Value ()
 destructor
virtual bool parse (const char *v)
 parse data from string
virtual void print (std::ostream &os) const
 print target value
virtual void print_default (std::ostream &os) const
 print default value
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
virtual bool valid_default () const
 check whether default value is valid
virtual bool valid_toggle () const
 check whether toggle value is valid
virtual unsigned count_default_chars () const
 count the length of default value string
virtual bool help_on () const
 check whether help message is turned on
virtual Valuedefault_value (value_type const &v, std::string const &d="")
 set default value
virtual Valuetoggle_value (value_type const &v)
 set toggle value
virtual Valuehelp (bool h)
 set help flag
virtual Valuerequired (bool r)
 set required flag
virtual Valuetoggle (bool t)
 set toggle flag
Public Member Functions inherited from limbo::programoptions::ValueBase
 ValueBase (std::string const &cat, std::string const &m)
 constructor
 ValueBase (ValueBase const &rhs)
 copy constructor
ValueBaseoperator= (ValueBase const &rhs)
 assignment
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
void print_msg (std::ostream &os) const
 print message

Protected Member Functions

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

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.

Member Typedef Documentation

◆ base_type

template<typename T>
typedef ValueBase limbo::programoptions::Value< T >::base_type

base type

Definition at line 223 of file ProgramOptions.h.

◆ value_type

template<typename T>
typedef T limbo::programoptions::Value< T >::value_type

data type

Definition at line 221 of file ProgramOptions.h.

Constructor & Destructor Documentation

◆ Value() [1/2]

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.

◆ Value() [2/2]

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.

◆ ~Value()

template<typename T>
virtual limbo::programoptions::Value< T >::~Value ( )
inlinevirtual

destructor

Definition at line 264 of file ProgramOptions.h.

Member Function Documentation

◆ apply_default()

template<typename T>
virtual void limbo::programoptions::Value< T >::apply_default ( )
inlinevirtual

apply default value

Implements limbo::programoptions::ValueBase.

Definition at line 313 of file ProgramOptions.h.

◆ apply_toggle()

template<typename T>
virtual void limbo::programoptions::Value< T >::apply_toggle ( )
inlinevirtual

apply toggle value

Implements limbo::programoptions::ValueBase.

Definition at line 321 of file ProgramOptions.h.

◆ copy()

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.

◆ count_default_chars()

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.

◆ default_value()

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.

◆ help()

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.

◆ help_on()

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.

◆ operator=()

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.

◆ parse()

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.

◆ print()

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.

◆ print_default()

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.

◆ required()

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.

◆ toggle()

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.

◆ toggle_value()

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.

◆ valid_default()

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.

◆ valid_target()

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.

◆ valid_toggle()

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.

Member Data Documentation

◆ m_default_display

template<typename T>
std::string limbo::programoptions::Value< T >::m_default_display
protected

display default value

Definition at line 450 of file ProgramOptions.h.

◆ m_default_value

template<typename T>
value_type* limbo::programoptions::Value< T >::m_default_value
protected

default value

Definition at line 448 of file ProgramOptions.h.

◆ m_target

template<typename T>
value_type* limbo::programoptions::Value< T >::m_target
protected

NULL for help.

Definition at line 447 of file ProgramOptions.h.

◆ m_toggle_value

template<typename T>
value_type* limbo::programoptions::Value< T >::m_toggle_value
protected

only valid when this option is a toggle value

Definition at line 449 of file ProgramOptions.h.


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