wibble 1.1
|
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 |
![]() | |
virtual | ~Managed () |
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. | |
virtual void | parse_noarg ()=0 |
Notify that the option is present in the command line, but has no arguments. | |
virtual bool | arg_is_optional () const |
Return true if the argument to this function can be omitted. | |
Protected Attributes | |
bool | m_isset |
Friends | |
class | OptionGroup |
class | Engine |
Interface for a parser for one commandline option.
|
inlineprotected |
|
inlineprotected |
References longNames, and shortNames.
wibble::commandline::Option::Option | ( | ) |
|
inlinevirtual |
References shortNames.
Referenced by Engine1::Engine1(), and wibble::commandline::StandardParser::StandardParser().
Return true if the argument to this function can be omitted.
Reimplemented in wibble::commandline::SingleOptvalOption< T >.
Referenced by fullUsage(), and fullUsageForMan().
const std::string & wibble::commandline::Option::fullUsage | ( | ) | const |
Return a full usage message including all the aliases for this option.
References arg_is_optional(), longNames, shortNames, and usage.
std::string wibble::commandline::Option::fullUsageForMan | ( | ) | const |
References arg_is_optional(), longNames, shortNames, and usage.
|
inline |
|
protectedpure 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::SingleOptvalOption< T >, and wibble::commandline::VectorOption< T >.
Parse the commandline parameter of a long commandline switch.
Implemented in wibble::commandline::BoolOption, wibble::commandline::SingleOption< T >, wibble::commandline::SingleOptvalOption< T >, and wibble::commandline::VectorOption< T >.
Notify that the option is present in the command line, but has no arguments.
Implemented in wibble::commandline::BoolOption, wibble::commandline::SingleOption< T >, wibble::commandline::SingleOptvalOption< T >, and wibble::commandline::VectorOption< T >.
|
friend |
std::string wibble::commandline::Option::description |
bool wibble::commandline::Option::hidden |
std::vector<std::string> wibble::commandline::Option::longNames |
Referenced by addAlias(), fullUsage(), fullUsageForMan(), and Option().
|
protected |
Referenced by isSet(), wibble::commandline::SingleOption< T >::parse(), wibble::commandline::VectorOption< T >::parse(), wibble::commandline::SingleOption< T >::parse(), wibble::commandline::SingleOptvalOption< T >::parse(), wibble::commandline::VectorOption< T >::parse(), wibble::commandline::BoolOption::parse_noarg(), and wibble::commandline::SingleOptvalOption< T >::parse_noarg().
std::vector<char> wibble::commandline::Option::shortNames |
Referenced by addAlias(), fullUsage(), fullUsageForMan(), and Option().
std::string wibble::commandline::Option::usage |
Referenced by fullUsage(), fullUsageForMan(), wibble::commandline::SingleOption< T >::SingleOption(), wibble::commandline::SingleOption< T >::SingleOption(), wibble::commandline::SingleOptvalOption< T >::SingleOptvalOption(), wibble::commandline::SingleOptvalOption< T >::SingleOptvalOption(), wibble::commandline::VectorOption< T >::VectorOption(), and wibble::commandline::VectorOption< T >::VectorOption().