Hold a shell string.
More...
Inherits util::Option.
|
| ShellOption (const char *name, const char *defaultVal, const char *usage, const char cmd, string *const storage=NULL) |
|
| ShellOption (const string &name, const string &defaultVal, const string &usage, const char cmd, string *const storage=NULL) |
|
| ~ShellOption () 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 string | getString () 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 int | getInt () const |
|
virtual float | getFloat () const |
|
virtual bool | getBool () const |
|
|
(Note that these are not member functions.)
|
ostream & | operator<< (ostream &os, Option &op) |
|
◆ ShellOption() [1/2]
util::ShellOption::ShellOption |
( |
const char * |
name, |
|
|
const char * |
defaultVal, |
|
|
const char * |
usage, |
|
|
const char |
cmd, |
|
|
string *const |
storage = NULL |
|
) |
| |
◆ ShellOption() [2/2]
util::ShellOption::ShellOption |
( |
const string & |
name, |
|
|
const string & |
defaultVal, |
|
|
const string & |
usage, |
|
|
const char |
cmd, |
|
|
string *const |
storage = NULL |
|
) |
| |
◆ ~ShellOption()
util::ShellOption::~ShellOption |
( |
| ) |
|
throw | ( | |
| ) | | |
|
inline |
◆ getTypeName()
virtual string util::ShellOption::getTypeName |
( |
| ) |
const |
|
inlinevirtual |
Return the type name of the option as a string.
Reimplemented from util::Option.
◆ setValue()
void util::ShellOption::setValue |
( |
const string & |
s | ) |
|
throw | ( | UException |
| ) | | |
|
virtual |
This function is the heart of the Option
class: it parses the value of the option from the supplied string
.
Implements util::Option.
◆ getString()
virtual string util::ShellOption::getString |
( |
| ) |
const |
|
virtual |
◆ toString()
virtual string util::ShellOption::toString |
( |
| ) |
const |
|
virtual |
Return the option's value as a string.
Implements util::Option.
◆ getInt()
virtual int util::Option::getInt |
( |
| ) |
const |
|
inlinevirtualinherited |
Acess the value of the option. Usually subclasses will not implement all of these, in fact, mostly just one of these.
Reimplemented in util::IntOption.
◆ getFloat()
virtual float util::Option::getFloat |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ getBool()
virtual bool util::Option::getBool |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ needsValue()
virtual bool util::Option::needsValue |
( |
| ) |
const |
|
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.
◆ getName()
const string& util::Option::getName |
( |
| ) |
const |
|
inherited |
Return the (long) option name.
◆ getCmdLineChar()
char util::Option::getCmdLineChar |
( |
| ) |
const |
|
inherited |
Return the short option char.
◆ getDefault()
const string& util::Option::getDefault |
( |
| ) |
const |
|
inherited |
Return the string representation of the default value.
◆ getUsage()
const string& util::Option::getUsage |
( |
| ) |
const |
|
inherited |
◆ value_
string util::ShellOption::value_ |
|
protected |
◆ storage_
string* util::ShellOption::storage_ |
|
protected |
◆ name_
string util::Option::name_ |
|
protectedinherited |
long option name (e.g. –long-option or long-option=value)
◆ default_
string util::Option::default_ |
|
protectedinherited |
string representation of default value
◆ usage_
string util::Option::usage_ |
|
protectedinherited |
◆ cmdlinechar_
char util::Option::cmdlinechar_ |
|
protectedinherited |
short option char, for command line use