wibble::commandline::SingleOption< T > Class Template Reference

`#include <options.h>`

Inheritance diagram for wibble::commandline::SingleOption< T >:
[legend]
Collaboration diagram for wibble::commandline::SingleOption< T >:
[legend]

## Public Member Functions

void | setValue (const typename T::value_type &a)
T::value_type | value () const
bool | boolValue () const
int | intValue () const
std::string | stringValue () const
Public Member Functions inherited from wibble::commandline::Option
| 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. More...
std::string | fullUsageForMan () const
Public Member Functions inherited from wibble::commandline::Managed
virtual | ~Managed ()

## Protected Member Functions

| SingleOption (const std::string &name)
| SingleOption (const std::string &name, char shortName, const std::string &longName, const std::string &usage=std::string(), const std::string &description=std::string())
ArgList::iterator | parse (ArgList &list, ArgList::iterator begin)
| Parse the next commandline parameter after the short form of the command has been found. More...
bool | parse (const std::string &param)
| Parse the commandline parameter of a long commandline switch. More...
void | parse_noarg ()
| Notify that the option is present in the command line, but has no arguments. More...
Protected Member Functions inherited from wibble::commandline::Option
| 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 bool | arg_is_optional () const
| Return true if the argument to this function can be omitted. More...

## Protected Attributes

T::value_type | m_value
Protected Attributes inherited from wibble::commandline::Option
bool | m_isset

## Friends

class | OptionGroup
class | Engine

## Additional Inherited Members

Public Attributes inherited from wibble::commandline::Option
std::vector< char > | shortNames
std::vector< std::string > | longNames
std::string | usage
std::string | description
bool | hidden

## Constructor & Destructor Documentation

## SingleOption() [1/2]

template<typename T >

wibble::commandline::SingleOption< T >::SingleOption | ( | const std::string & | name | ) |

inline protected

References usage().

## SingleOption() [2/2]

template<typename T >

wibble::commandline::SingleOption< T >::SingleOption | ( | 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 usage().

## Member Function Documentation

## boolValue()

template<typename T >

bool wibble::commandline::SingleOption< T >::boolValue | ( |  | ) | const

inline

Referenced by TestCommandlineEngine::longOptsWithDashes(), TestCommandlineEngine::optsOnly(), and withCommands().

## intValue()

template<typename T >

int wibble::commandline::SingleOption< T >::intValue | ( |  | ) | const

inline

## parse() [1/2]

template<typename T >

ArgList::iterator wibble::commandline::SingleOption< T >::parse | ( | ArgList & | list,
|  | ArgList::iterator | begin
| ) |  |

inline protected 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).

Returns
  true if it used the argument, else false

Implements wibble::commandline::Option.

References wibble::commandline::ArgList::eraseAndAdvance().

## parse() [2/2]

template<typename T >

bool wibble::commandline::SingleOption< T >::parse | ( | const std::string & | param | ) |

inline protected virtual

Parse the commandline parameter of a long commandline switch.

Returns
  true if the parameter has been used

Implements wibble::commandline::Option.

## parse_noarg()

template<typename T >

void wibble::commandline::SingleOption< T >::parse_noarg | ( |  | ) |

inline protected virtual

Notify that the option is present in the command line, but has no arguments.

Implements wibble::commandline::Option.

## setValue()

template<typename T >

void wibble::commandline::SingleOption< T >::setValue | ( | const typename T::value_type & | a | ) |

inline

## stringValue()

template<typename T >

std::string wibble::commandline::SingleOption< T >::stringValue | ( |  | ) | const

inline

Referenced by TestCommandlineEngine::clusteredShortOpts(), TestCommandlineEngine::commandsWithoutCommand(), TestCommandlineEngine::commandsWithOverlappingArgs(), TestCommandlineEngine::commandWithArg(), TestCommandlineEngine::longOptsWithArgs(), TestCommandlineEngine::noSwitchesAfterFirstArg(), and TestCommandlineEngine::optsAndArgs().

## value()

template<typename T >

T::value_type wibble::commandline::SingleOption< T >::value | ( |  | ) | const

inline

## Friends And Related Function Documentation

## Engine

template<typename T >

friend class Engine

friend

## OptionGroup

template<typename T >

friend class OptionGroup

friend

## Member Data Documentation

## m_value

template<typename T >

T::value_type wibble::commandline::SingleOption< T >::m_value

protected

The documentation for this class was generated from the following file:

- options.h