|
ui-utilcpp
1.8.3
|
Most general class for a command line option. Use this class for a option without argument. More...
#include <GetOpt.hpp>


Public Member Functions | |
| CLOption (std::string const &nameLong, char nameShort, std::string const &doc="No documentation for this option.", std::string const &defaultArg="") | |
| Standard constructor. Normally, you would not use this directly, but rather use GetOpt::set. More... | |
| std::string | getNameLong () const |
| Get the long name. More... | |
| char | getNameShort () const |
| Get the short name. More... | |
| std::string | getDoc () const |
| Get the documentation. More... | |
| bool | isGiven () const |
| Check if this option was given. More... | |
| std::string | getArg () const |
| Get argument given with this option. More... | |
| virtual void | printUsage () const |
| Print usage information for this option. | |
| virtual option * | getCOptLong (option *opt) const |
| Get GNU getopt_long(3) represention of this option. More... | |
| virtual std::string | getCOptShort () const |
| Get GNU getopt(3) represention of this option. More... | |
| virtual void | setGiven (std::string const &arg="") |
| Mark this option as "given", and optionally set the argument. More... | |
Protected Attributes | |
| std::string const | defaultArg_ |
Most general class for a command line option. Use this class for a option without argument.
| UI::Util::CLOption::CLOption | ( | std::string const & | nameLong, |
| char | nameShort, | ||
| std::string const & | doc = "No documentation for this option.", |
||
| std::string const & | defaultArg = "" |
||
| ) |
Standard constructor. Normally, you would not use this directly, but rather use GetOpt::set.
| nameLong | Long name of the option; e.g. "version". |
| nameShort | Short name (one character) of the option; e.g. 'v'. |
| doc | Documentation string for this option; e.g. "Show version information". |
| defaultArg | Default value for that option. |
| std::string UI::Util::CLOption::getArg | ( | ) | const |
Get argument given with this option.
References defaultArg_, and isGiven().
|
virtual |
Get GNU getopt_long(3) represention of this option.
Reimplemented in UI::Util::CLOptionOptArg, and UI::Util::CLOptionArg.
Referenced by UI::Util::CLOptionArg::getCOptLong(), and UI::Util::CLOptionOptArg::getCOptLong().
|
virtual |
Get GNU getopt(3) represention of this option.
Reimplemented in UI::Util::CLOptionOptArg, and UI::Util::CLOptionArg.
| std::string UI::Util::CLOption::getDoc | ( | ) | const |
Get the documentation.
Referenced by UI::Util::CLOptionArg::printUsage(), and UI::Util::CLOptionOptArg::printUsage().
| std::string UI::Util::CLOption::getNameLong | ( | ) | const |
Get the long name.
Referenced by UI::Util::GetOpt::get(), UI::Util::CLOptionArg::printUsage(), and UI::Util::CLOptionOptArg::printUsage().
| char UI::Util::CLOption::getNameShort | ( | ) | const |
Get the short name.
Referenced by UI::Util::GetOpt::get(), UI::Util::CLOptionArg::getCOptShort(), UI::Util::CLOptionOptArg::getCOptShort(), UI::Util::CLOptionArg::printUsage(), and UI::Util::CLOptionOptArg::printUsage().
| bool UI::Util::CLOption::isGiven | ( | ) | const |
Check if this option was given.
Referenced by getArg().
|
virtual |
Mark this option as "given", and optionally set the argument.
| arg | Argument string to set this option to. |
|
protected |
Option argument
Referenced by getArg(), UI::Util::CLOptionArg::printUsage(), and UI::Util::CLOptionOptArg::printUsage().
1.8.9.1