|
LTL
2.0.x
|
Hold an integer number. More...
Inherits util::Option.
Public Member Functions | |
| IntOption (const char *name, const char *defaultVal, const char *usage, const char cmd, int *const storage=NULL) | |
| IntOption (const string &name, const string &defaultVal, const string &usage, const char cmd, int *const storage=NULL) | |
| ~IntOption () throw () | |
| virtual string | getTypeName () const |
| Return the type name of the option as a string. More... | |
| void | setValue (const string &s) throw (UException) |
This function is the heart of the Option class: it parses the value of the option from the supplied string. More... | |
| virtual int | getInt () const |
| virtual string | toString () const |
| Return the option's value as a string. More... | |
| virtual bool | needsValue () const |
| const string & | getName () const |
| Return the (long) option name. More... | |
| char | getCmdLineChar () const |
| Return the short option char. More... | |
| const string & | getDefault () const |
| Return the string representation of the default value. More... | |
| const string & | getUsage () const |
| Return the help string. More... | |
| virtual float | getFloat () const |
| virtual string | getString () const |
| virtual bool | getBool () const |
Protected Attributes | |
| int | value_ |
| int * | storage_ |
| string | name_ |
| long option name (e.g. –long-option or long-option=value) More... | |
| string | default_ |
| string representation of default value More... | |
| string | usage_ |
| help string More... | |
| char | cmdlinechar_ |
| short option char, for command line use More... | |
Related Functions | |
(Note that these are not member functions.) | |
| ostream & | operator<< (ostream &os, Option &op) |
Hold an integer number.
These are the specializations for various types and arrays of types. Each of these implements overloads the parser function:
and the accessor function(s) returning the appropriate type.
The constructors have a further parameter which is a pointer to the option's (native) type. The option will also write its value to that location if the pointer is not NULL; Useful for easily setting global parameters, or filling a struct with parameter values without having to manually loop over and read all program option's values.
| util::IntOption::IntOption | ( | const char * | name, |
| const char * | defaultVal, | ||
| const char * | usage, | ||
| const char | cmd, | ||
| int *const | storage = NULL |
||
| ) |
| util::IntOption::IntOption | ( | const string & | name, |
| const string & | defaultVal, | ||
| const string & | usage, | ||
| const char | cmd, | ||
| int *const | storage = NULL |
||
| ) |
|
inline | |||||||||||||
|
inlinevirtual |
Return the type name of the option as a string.
Reimplemented from util::Option.
|
virtual | ||||||||||||||
This function is the heart of the Option class: it parses the value of the option from the supplied string.
Implements util::Option.
|
virtual |
Acess the value of the option. Usually subclasses will not implement all of these, in fact, mostly just one of these.
Reimplemented from util::Option.
|
virtual |
Return the option's value as a string.
Implements util::Option.
|
inlinevirtualinherited |
Reimplemented in util::FloatOption.
|
inlinevirtualinherited |
Reimplemented in util::StringOption.
|
inlinevirtualinherited |
Reimplemented in util::BoolOption.
|
inlinevirtualinherited |
Return true if the option needs a value, false if it is a toggle-switch needing no value. On the command line, values are given as –long-option value, or -x value. In a config file, long-option = value. '#' can be used to delineate comments. See CommandLineReader and ConfigFileReader.
Reimplemented in util::BoolOption.
|
inherited |
Return the (long) option name.
|
inherited |
Return the short option char.
|
inherited |
Return the string representation of the default value.
|
inherited |
Return the help string.
|
protected |
|
protected |
|
protectedinherited |
long option name (e.g. –long-option or long-option=value)
|
protectedinherited |
string representation of default value
|
protectedinherited |
help string
|
protectedinherited |
short option char, for command line use
1.8.5