Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/option/Manager.h>
Classes | |
class | Make |
Public Types | |
typedef const char *const * | argv_t |
Public Member Functions | |
Manager (void) | |
Manager (int tag,...) | |
Manager (const Make &maker) | |
virtual | ~Manager (void) |
void | addOption (Option *option) throw (OptionException) |
void | removeOption (Option *option) |
void | parse (int argc, argv_t argv) throw (OptionException) |
void | displayHelp (void) |
cstring | getProgram (void) const |
const Version & | getVersion (void) const |
cstring | getAuthor (void) const |
cstring | getCopyright (void) const |
cstring | getDescription (void) const |
cstring | getFreeArgumentDescription (void) const |
Protected Member Functions | |
virtual void | process (String arg) |
virtual void | configure (int tag, VarArg &args) |
Protected Attributes | |
Make | info |
This class is used for managing the options of a command.
typedef const char* const* elm::option::Manager::argv_t |
elm::option::Manager::Manager | ( | void | ) |
elm::option::Manager::Manager | ( | int | tag, |
... | |||
) |
Build a manager with the new method.
config | First configuration item. |
... | end() ended configuration item list. |
References configure(), and elm::option::end.
elm::option::Manager::Manager | ( | const Make & | maker | ) |
Build a new option manager.
maker | Information for initialization. |
|
virtual |
void elm::option::Manager::addOption | ( | Option * | option | ) | |
throw | ( | OptionException | |||
) |
Add an option to the manager.
option | Option to add. |
OptionException | If the short name or the long name is already used. |
Referenced by elm::option::Option::init(), and elm::option::Option::Option().
|
protectedvirtual |
Called for each configuration tag. May be overload to customize Manager configuration.
tag | Current tag. |
args | Argument list. |
References elm::option::arg_desc, elm::option::author, elm::option::copyright, elm::option::description, elm::option::free_arg, info, elm::VarArg::next(), elm::option::program, and elm::option::version.
Referenced by Manager().
void elm::option::Manager::displayHelp | ( | void | ) |
Display the help text to standard error.
References elm::option::arg_none, elm::option::arg_optional, elm::option::arg_required, elm::option::Option::argDescription(), elm::option::author, elm::cerr, elm::option::copyright, elm::option::Option::description(), elm::io::endl, info, elm::pair(), elm::option::Option::usage(), and elm::option::version.
void elm::option::Manager::parse | ( | int | argc, |
Manager::argv_t | argv | ||
) | |||
throw | ( | OptionException | |
) |
Parse the given options.
argc | Argument count. |
argv | Argument vector. |
OptionException | Thrown if the syntax contains an error. |
References elm::_, elm::String::indexOf(), elm::String::length(), and elm::String::substring().
|
protectedvirtual |
Called each time a free argumend (not tied to an option) is found.
arg | Free argument value. |
void elm::option::Manager::removeOption | ( | Option * | option | ) |
Remove the option from the manager.
option | Option to remove. |
|
protected |
Referenced by configure(), displayHelp(), getAuthor(), getCopyright(), getDescription(), getFreeArgumentDescription(), getProgram(), and getVersion().