#include <args_handler.hh>
Iterate over our parameters (non - and -- switches and their values) | |
typedef WrappedForwardIterator < ParametersConstIteratorTag, const std::string > | ParametersConstIterator |
ParametersConstIterator | begin_parameters () const |
ParametersConstIterator | end_parameters () const |
bool | empty () const |
Iterate over our usage lines (for documentation) | |
typedef WrappedForwardIterator < UsageLineConstIteratorTag, const std::string > | UsageLineConstIterator |
UsageLineConstIterator | begin_usage_lines () const |
UsageLineConstIterator | end_usage_lines () const |
Iterate over our environment lines (for documentation) | |
typedef WrappedForwardIterator < EnvironmentLineConstIteratorTag, const std::pair< std::string, std::string > > | EnvironmentLineConstIterator |
EnvironmentLineConstIterator | begin_environment_lines () const |
EnvironmentLineConstIterator | end_environment_lines () const |
Iterate over our examples (for documentation) | |
typedef WrappedForwardIterator < ExamplesConstIteratorTag, const std::pair< std::string, std::string > > | ExamplesConstIterator |
ExamplesConstIterator | begin_examples () const |
ExamplesConstIterator | end_examples () const |
Iterate over our sections | |
typedef WrappedForwardIterator < ArgsSectionsConstIteratorTag, const ArgsSection > | ArgsSectionsConstIterator |
ArgsSectionsConstIterator | begin_args_sections () const |
ArgsSectionsConstIterator | end_args_sections () const |
ArgsSection * | main_options_section () PALUDIS_ATTRIBUTE((warn_unused_result)) |
Iterate over our notes | |
typedef WrappedForwardIterator < NotesIteratorTag, const std::string > | NotesIterator |
NotesIterator | begin_notes () const |
NotesIterator | end_notes () const |
Iterate over our extra description lines (for documentation) | |
typedef WrappedForwardIterator < DescriptionLineConstIteratorTag, const std::string > | DescriptionLineConstIterator |
DescriptionLineConstIterator | begin_description_lines () const |
DescriptionLineConstIterator | end_description_lines () const |
Basic operations | |
ArgsHandler () | |
virtual | ~ArgsHandler () |
About our application (for documentation) | |
virtual std::string | app_name () const =0 |
virtual std::string | man_section () const |
virtual std::string | app_synopsis () const =0 |
virtual std::string | app_description () const =0 |
Public Member Functions | |
void | add_option (ArgsOption *const, const std::string &long_name, const char short_name= '\0') |
void | remove_option (const std::string &long_name, const char short_name= '\0') |
void | run (const int argc, const char *const *const argv, const std::string &client, const std::string &env_var, const std::string &env_prefix, const ArgsHandlerOptions &options=ArgsHandlerOptions()) |
void | run (const std::tr1::shared_ptr< const Sequence< std::string > > &, const std::string &client, const std::string &env_var, const std::string &env_prefix, const ArgsHandlerOptions &options=ArgsHandlerOptions()) |
Protected Member Functions | |
void | add_usage_line (const std::string &l) |
void | add_environment_variable (const std::string &e, const std::string &desc) |
void | add_example (const std::string &e, const std::string &desc) |
void | add_note (const std::string &) |
void | add_description_line (const std::string &l) |
void | add (ArgsSection *const) |
void | dump_to_stream (std::ostream &s) const |
virtual void | post_run () |
Friends | |
class | ArgsSection |
std::ostream & | operator<< (std::ostream &, const ArgsHandler &) |
void paludis::args::ArgsHandler::add_usage_line | ( | const std::string & | l | ) | [protected] |
Add a new usage line.
void paludis::args::ArgsHandler::add_environment_variable | ( | const std::string & | e, | |
const std::string & | desc | |||
) | [protected] |
Add a new environment line.
void paludis::args::ArgsHandler::add_example | ( | const std::string & | e, | |
const std::string & | desc | |||
) | [protected] |
Add a new example.
void paludis::args::ArgsHandler::add_note | ( | const std::string & | ) | [protected] |
Add a new note.
void paludis::args::ArgsHandler::add_description_line | ( | const std::string & | l | ) | [protected] |
Add a new description.
void paludis::args::ArgsHandler::add | ( | ArgsSection * | const | ) | [protected] |
Add an new ArgsSection (called by the ArgsSection constructor).
void paludis::args::ArgsHandler::dump_to_stream | ( | std::ostream & | s | ) | const [protected] |
Dump, for --help output (called by operator<<).
virtual void paludis::args::ArgsHandler::post_run | ( | ) | [protected, virtual] |
Called after run(), for convenience. Does nothing.
void paludis::args::ArgsHandler::add_option | ( | ArgsOption * | const, | |
const std::string & | long_name, | |||
const char | short_name = '\0' | |||
) |
Add an ArgsOption instance.
void paludis::args::ArgsHandler::remove_option | ( | const std::string & | long_name, | |
const char | short_name = '\0' | |||
) |
Remove an ArgsOption instance.
virtual std::string paludis::args::ArgsHandler::app_name | ( | ) | const [pure virtual] |
What is our application name?
Implemented in examples::CommandLine.
virtual std::string paludis::args::ArgsHandler::man_section | ( | ) | const [inline, virtual] |
What is our application's Unix manual section?
virtual std::string paludis::args::ArgsHandler::app_synopsis | ( | ) | const [pure virtual] |
One line synopsis of what our application is.
Implemented in examples::CommandLine.
virtual std::string paludis::args::ArgsHandler::app_description | ( | ) | const [pure virtual] |
Long description of what our application is.
Implemented in examples::CommandLine.
ArgsSection* paludis::args::ArgsHandler::main_options_section | ( | ) |
The 'Options' section.
Created if it does not exist.
void paludis::args::ArgsHandler::run | ( | const int | argc, | |
const char *const *const | argv, | |||
const std::string & | client, | |||
const std::string & | env_var, | |||
const std::string & | env_prefix, | |||
const ArgsHandlerOptions & | options = ArgsHandlerOptions() | |||
) |
Parse command line arguments. The third argument is used to set PALUDIS_CLIENT. The fourth argument is the name of an environment variable holding arguments which are prepended to the command line arguments. The fifth argument is used as a prefix to export our command line via the environment.
void paludis::args::ArgsHandler::run | ( | const std::tr1::shared_ptr< const Sequence< std::string > > & | , | |
const std::string & | client, | |||
const std::string & | env_var, | |||
const std::string & | env_prefix, | |||
const ArgsHandlerOptions & | options = ArgsHandlerOptions() | |||
) |
Parse command line arguments. The third argument is used to set PALUDIS_CLIENT. The fourth argument is the name of an environment variable holding arguments which are prepended to the command line arguments. The fifth argument is used as a prefix to export our command line via the environment.
std::ostream& operator<< | ( | std::ostream & | , | |
const ArgsHandler & | ||||
) | [friend] |
Output an ArgsHandler to an ostream, for --help output.