Limbo
|
a generic class for various data values More...
#include <ProgramOptions.h>
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... | |
Value & | operator= (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 Value & | default_value (value_type const &v, std::string const &d="") |
set default value More... | |
virtual Value & | toggle_value (value_type const &v) |
set toggle value More... | |
virtual Value & | help (bool h) |
set help flag More... | |
virtual Value & | required (bool r) |
set required flag More... | |
virtual Value & | toggle (bool t) |
set toggle flag More... | |
![]() | |
ValueBase (std::string const &cat, std::string const &m) | |
constructor More... | |
ValueBase (ValueBase const &rhs) | |
copy constructor More... | |
ValueBase & | operator= (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... | |
![]() | |
void | copy (ValueBase const &rhs) |
copy another object More... | |
Protected Attributes | |
value_type * | m_target |
NULL for help. | |
value_type * | m_default_value |
default value | |
value_type * | m_toggle_value |
only valid when this option is a toggle value | |
std::string | m_default_display |
display default value | |
![]() | |
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 | |
a generic class for various data values
T | data type |
Definition at line 217 of file ProgramOptions.h.
|
inline |
constructor
cat | category |
target | a pointer of target |
m | message |
Definition at line 231 of file ProgramOptions.h.
|
inline |
|
inlineprotected |
|
inlinevirtual |
count the length of default value string
Implements limbo::programoptions::ValueBase.
Definition at line 357 of file ProgramOptions.h.
|
inlinevirtual |
set default value
v | value |
d | a string to display the value |
Definition at line 380 of file ProgramOptions.h.
|
inlinevirtual |
set help flag
h | value |
Definition at line 405 of file ProgramOptions.h.
|
inlinevirtual |
check whether help message is turned on
Implements limbo::programoptions::ValueBase.
Definition at line 367 of file ProgramOptions.h.
|
inline |
assignment
rhs | the other object |
Definition at line 252 of file ProgramOptions.h.
|
inlinevirtual |
parse data from string
v | data value in string |
Implements limbo::programoptions::ValueBase.
Definition at line 277 of file ProgramOptions.h.
|
inlinevirtual |
print target value
os | output stream |
Implements limbo::programoptions::ValueBase.
Definition at line 292 of file ProgramOptions.h.
|
inlinevirtual |
print default value
os | output stream |
Implements limbo::programoptions::ValueBase.
Definition at line 301 of file ProgramOptions.h.
|
inlinevirtual |
set required flag
r | value |
Definition at line 415 of file ProgramOptions.h.
|
inlinevirtual |
set toggle flag
t | value |
Definition at line 425 of file ProgramOptions.h.
|
inlinevirtual |
set toggle value
v | value |
Definition at line 393 of file ProgramOptions.h.
|
inlinevirtual |
check whether default value is valid
Implements limbo::programoptions::ValueBase.
Definition at line 341 of file ProgramOptions.h.
|
inlinevirtual |
check whether target value is valid
Implements limbo::programoptions::ValueBase.
Definition at line 333 of file ProgramOptions.h.
|
inlinevirtual |
check whether toggle value is valid
Implements limbo::programoptions::ValueBase.
Definition at line 349 of file ProgramOptions.h.