Interface for a parser for one commandline option. More...
#include <options.h>
Public Member Functions | |
Option () | |
virtual | ~Option () |
bool | isSet () const |
const std::string & | name () const |
void | addAlias (char c) |
void | addAlias (const std::string &str) |
const std::string & | fullUsage () const |
Return a full usage message including all the aliases for this option. | |
std::string | fullUsageForMan () const |
Public Attributes | |
std::vector< char > | shortNames |
std::vector< std::string > | longNames |
std::string | usage |
std::string | description |
bool | hidden |
Protected Member Functions | |
Option (const std::string &name) | |
Option (const std::string &name, char shortName, const std::string &longName, const std::string &usage=std::string(), const std::string &description=std::string()) | |
virtual ArgList::iterator | parse (ArgList &list, ArgList::iterator begin)=0 |
Parse the next commandline parameter after the short form of the command has been found. | |
virtual bool | parse (const std::string ¶m)=0 |
Parse the commandline parameter of a long commandline switch. | |
Protected Attributes | |
bool | m_isset |
Friends | |
class | OptionGroup |
class | Engine |
Interface for a parser for one commandline option.
wibble::commandline::Option::Option | ( | const std::string & | name | ) | [inline, protected] |
wibble::commandline::Option::Option | ( | const std::string & | name, | |
char | shortName, | |||
const std::string & | longName, | |||
const std::string & | usage = std::string() , |
|||
const std::string & | description = std::string() | |||
) | [inline, protected] |
References longNames, and shortNames.
wibble::commandline::Option::Option | ( | ) |
virtual wibble::commandline::Option::~Option | ( | ) | [inline, virtual] |
void wibble::commandline::Option::addAlias | ( | char | c | ) | [inline] |
References shortNames.
Referenced by wibble::commandline::StandardParser::StandardParser().
void wibble::commandline::Option::addAlias | ( | const std::string & | str | ) | [inline] |
References longNames.
const std::string & wibble::commandline::Option::fullUsage | ( | ) | const |
Return a full usage message including all the aliases for this option.
References longNames, and shortNames.
std::string wibble::commandline::Option::fullUsageForMan | ( | ) | const |
References longNames, and shortNames.
bool wibble::commandline::Option::isSet | ( | ) | const [inline] |
References m_isset.
Referenced by wibble::commandline::StandardParserWithManpage::parse().
const std::string& wibble::commandline::Option::name | ( | ) | const [inline] |
virtual bool wibble::commandline::Option::parse | ( | const std::string & | param | ) | [protected, pure virtual] |
Parse the commandline parameter of a long commandline switch.
Implemented in wibble::commandline::BoolOption, wibble::commandline::SingleOption< T >, wibble::commandline::VectorOption< T >, and wibble::commandline::SingleOption< Int >.
virtual ArgList::iterator wibble::commandline::Option::parse | ( | ArgList & | list, | |
ArgList::iterator | begin | |||
) | [protected, pure virtual] |
Parse the next commandline parameter after the short form of the command has been found.
It may or may not remove the parameter from the list, depending on if the option wants a value or not.
Signal that the option has been found, with the given argument (or 0 if no argument).
Implemented in wibble::commandline::BoolOption, wibble::commandline::SingleOption< T >, wibble::commandline::VectorOption< T >, and wibble::commandline::SingleOption< Int >.
friend class Engine [friend] |
friend class OptionGroup [friend] |
std::string wibble::commandline::Option::description |
std::vector<std::string> wibble::commandline::Option::longNames |
Referenced by addAlias(), wibble::commandline::Engine::addWithoutAna(), fullUsage(), fullUsageForMan(), and Option().
bool wibble::commandline::Option::m_isset [protected] |
std::vector<char> wibble::commandline::Option::shortNames |
Referenced by addAlias(), wibble::commandline::Engine::addWithoutAna(), fullUsage(), fullUsageForMan(), and Option().
std::string wibble::commandline::Option::usage |