paludis  Version 2.6.0
Public Member Functions | Protected Member Functions | Friends | List of all members
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 &)
 

Basic operations

 ArgsHandler ()
 
virtual ~ArgsHandler ()
 
 ArgsHandler (const ArgsHandler &)=delete
 
ArgsHandleroperator= (const ArgsHandler &)=delete
 

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

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
 

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< UsageLineConstIteratorusage_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< EnvironmentLineConstIteratorenvironment_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< ExamplesConstIteratorexamples () const
 

Iterate over our sections

typedef WrappedForwardIterator< ArgsSectionsConstIteratorTag, const ArgsSectionArgsSectionsConstIterator
 
ArgsSectionsConstIterator begin_args_sections () const
 
ArgsSectionsConstIterator end_args_sections () const
 
IteratorRange< ArgsSectionsConstIteratorargs_sections () const
 
ArgsSectionmain_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< NotesIteratornotes () 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< DescriptionLineConstIteratordescription_lines () const
 

Iterate over our 'see also' lines

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

For use by ArgsVisitor

typedef WrappedForwardIterator< ArgsIteratorTag, std::string > ArgsIterator
 

Detailed Description

Handles command line arguments.

Member Function Documentation

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

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

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

Add a new description.

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_option ( ArgsOption const,
const std::string &  long_name,
const char  short_name = '\0' 
)

Add an ArgsOption instance.

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

Add a 'see also' item.

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

Add a new usage line.

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

Long description of what our application is.

Implemented in examples::CommandLine.

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::app_synopsis ( ) const
pure virtual

One line synopsis of what our application is.

Implemented in examples::CommandLine.

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

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

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

The 'Options' section.

Created if it does not exist.

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

What is our application's Unix manual section?

References paludis::args::operator<<(), PALUDIS_ATTRIBUTE, and PALUDIS_VISIBLE.

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

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

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

Remove an ArgsOption instance.

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::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.

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

Friends And Related Function Documentation

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: