paludis Version 3.0.2
The one true package mangler
paludis::args::ArgsHandler Class Referenceabstract

#include <args_handler.hh>

Inheritance diagram for paludis::args::ArgsHandler:

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::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_see_also (const std::string &, int section)
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 &)

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
IteratorRange< ParametersConstIterator > parameters () const
bool empty () const
const std::shared_ptr< const Sequence< std::string > > separate_after_dashes_args () const PALUDIS_ATTRIBUTE((warn_unused_result))

Iterate over our usage lines (for documentation)

typedef WrappedForwardIterator< UsageLineConstIteratorTag, const std::string > UsageLineConstIterator
UsageLineConstIterator begin_usage_lines () const
UsageLineConstIterator end_usage_lines () const
IteratorRange< UsageLineConstIterator > 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
IteratorRange< EnvironmentLineConstIterator > 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
IteratorRange< ExamplesConstIterator > examples () const

Iterate over our sections

typedef WrappedForwardIterator< ArgsSectionsConstIteratorTag, const ArgsSection > ArgsSectionsConstIterator
ArgsSectionsConstIterator begin_args_sections () const
ArgsSectionsConstIterator end_args_sections () const
IteratorRange< ArgsSectionsConstIterator > 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
IteratorRange< NotesIterator > 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
IteratorRange< DescriptionLineConstIterator > description_lines () const

Iterate over our 'see also' lines

typedef WrappedForwardIterator< SeeAlsoConstIteratorTag, const std::pair< std::string, int > > SeeAlsoConstIterator
SeeAlsoConstIterator begin_see_alsos () const
SeeAlsoConstIterator end_see_alsos () const
IteratorRange< SeeAlsoConstIterator > see_alsos () const

For use by ArgsVisitor

typedef WrappedForwardIterator< ArgsIteratorTag, std::string > ArgsIterator

Basic operations

 ArgsHandler (const ArgsHandler &)=delete
ArgsHandler & operator= (const ArgsHandler &)=delete

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

Detailed Description

Handles command line arguments.

Member Function Documentation

◆ add()

void paludis::args::ArgsHandler::add ( ArgsSection * const )
protected

Add an new ArgsSection (called by the ArgsSection constructor).

◆ add_description_line()

void paludis::args::ArgsHandler::add_description_line ( const std::string & l)
protected

Add a new description.

◆ add_environment_variable()

void paludis::args::ArgsHandler::add_environment_variable ( const std::string & e,
const std::string & desc )
protected

Add a new environment line.

◆ add_example()

void paludis::args::ArgsHandler::add_example ( const std::string & e,
const std::string & desc )
protected

Add a new example.

◆ add_note()

void paludis::args::ArgsHandler::add_note ( const std::string & )
protected

Add a new note.

◆ add_option()

void paludis::args::ArgsHandler::add_option ( ArgsOption * const ,
const std::string & long_name,
const char short_name = '\0' )

Add an ArgsOption instance.

References add_option().

Referenced by add_option().

◆ add_see_also()

void paludis::args::ArgsHandler::add_see_also ( const std::string & ,
int section )
protected

Add a 'see also' item.

Since
0.48.2

◆ add_usage_line()

void paludis::args::ArgsHandler::add_usage_line ( const std::string & l)
protected

Add a new usage line.

◆ app_description()

virtual std::string paludis::args::ArgsHandler::app_description ( ) const
pure virtual

Long description of what our application is.

Implemented in examples::CommandLine.

◆ app_name()

virtual std::string paludis::args::ArgsHandler::app_name ( ) const
pure virtual

What is our application name?

Implemented in examples::CommandLine.

References app_name().

Referenced by app_name().

◆ app_synopsis()

virtual std::string paludis::args::ArgsHandler::app_synopsis ( ) const
pure virtual

One line synopsis of what our application is.

Implemented in examples::CommandLine.

◆ dump_to_stream()

void paludis::args::ArgsHandler::dump_to_stream ( std::ostream & s) const
protected

Dump, for –help output (called by operator<<).

◆ main_options_section()

ArgsSection * paludis::args::ArgsHandler::main_options_section ( )

The 'Options' section.

Created if it does not exist.

References PALUDIS_ATTRIBUTE.

◆ man_section()

virtual std::string paludis::args::ArgsHandler::man_section ( ) const
inlinevirtual

What is our application's Unix manual section?

References man_section().

Referenced by man_section().

◆ post_run()

virtual void paludis::args::ArgsHandler::post_run ( )
protectedvirtual

Called after run(), for convenience. Does nothing.

◆ remove_option()

void paludis::args::ArgsHandler::remove_option ( const std::string & long_name,
const char short_name = '\0' )

Remove an ArgsOption instance.

References remove_option().

Referenced by remove_option().

◆ run() [1/2]

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.

◆ run() [2/2]

void paludis::args::ArgsHandler::run ( const std::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.

◆ separate_after_dashes_args()

const std::shared_ptr< const Sequence< std::string > > paludis::args::ArgsHandler::separate_after_dashes_args ( ) const

If aho_separate_after_dashes, everything after a – goes here.

Since
0.47

References PALUDIS_ATTRIBUTE.

◆ operator<<

std::ostream & operator<< ( std::ostream & ,
const ArgsHandler &  )
friend

Output an ArgsHandler to an ostream, for –help output.


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