wibble  1.1
Public Member Functions | Public Attributes | Protected Attributes | List of all members
wibble::commandline::StandardParser Class Reference

Parser for commandline arguments, with builting help functions. More...

#include <parser.h>

Inheritance diagram for wibble::commandline::StandardParser:
Inheritance graph
[legend]
Collaboration diagram for wibble::commandline::StandardParser:
Collaboration graph
[legend]

Public Member Functions

 StandardParser (const std::string &appname, const std::string &version)
 
void outputHelp (std::ostream &out)
 
bool parse (int argc, const char *argv[])
 
- Public Member Functions inherited from wibble::commandline::Parser
 Parser (const std::string &name, const std::string &usage=std::string(), const std::string &description=std::string(), const std::string &longDescription=std::string())
 
bool parse (int argc, const char *argv[])
 Parse the commandline. More...
 
bool hasNext () const
 
std::string next ()
 
- Public Member Functions inherited from wibble::commandline::Engine
const std::string & name () const
 
Optionadd (Option *o)
 Add an Option to this engine. More...
 
OptionGroupadd (OptionGroup *group)
 Add an OptionGroup to this engine. More...
 
Engineadd (Engine *o)
 Add a Engine to this engine. More...
 
template<typename T >
T * create (const std::string &name, char shortName, const std::string &longName, const std::string &usage=std::string(), const std::string &description=std::string())
 Create an option. More...
 
template<typename T >
T * add (const std::string &name, char shortName, const std::string &longName, const std::string &usage=std::string(), const std::string &description=std::string())
 Create an option and add to this engine. More...
 
OptionGroupcreateGroup (const std::string &description)
 Create an OptionGroup. More...
 
OptionGroupaddGroup (const std::string &description)
 Create an OptionGroup and add it to this engine. More...
 
EnginecreateEngine (const std::string &name, const std::string &usage=std::string(), const std::string &description=std::string(), const std::string &longDescription=std::string())
 Create a Engine. More...
 
EngineaddEngine (const std::string &name, const std::string &usage=std::string(), const std::string &description=std::string(), const std::string &longDescription=std::string())
 Create a Engine and add it to this engine as a command. More...
 
const std::vector< OptionGroup * > & groups () const
 Get the OptionGroups that have been added to this engine. More...
 
const std::vector< Option * > & options () const
 Get the Options that have been added to this engine. More...
 
const std::vector< Engine * > & commands () const
 Get the Engines that have been added to this engine. More...
 
Enginecommand (const std::string &name) const
 
bool hasOptions () const
 Returns true if this Engine has options to parse. More...
 
EnginefoundCommand () const
 Return the command that has been found in the commandline, or NULL if none have been found. More...
 
void dump (std::ostream &out, const std::string &prefix=std::string())
 
- Public Member Functions inherited from wibble::commandline::Managed
virtual ~Managed ()
 

Public Attributes

OptionGrouphelpGroup
 
BoolOptionhelp
 
BoolOptionversion
 
- Public Attributes inherited from wibble::commandline::Engine
std::string primaryAlias
 
std::vector< std::string > aliases
 
std::string usage
 
std::string description
 
std::string longDescription
 
std::string examples
 
bool hidden
 
bool no_switches_after_first_arg
 

Protected Attributes

std::string m_version
 
- Protected Attributes inherited from wibble::commandline::Parser
ArgList m_args
 
MemoryManager m_manager
 
- Protected Attributes inherited from wibble::commandline::Engine
std::vector< OptionGroup * > m_groups
 
std::vector< Option * > m_options
 
std::vector< Engine * > m_commands
 
std::map< char, Option * > m_short
 
std::map< std::string, Option * > m_long
 
std::map< std::string, Engine * > m_aliases
 
Enginem_found_command
 

Additional Inherited Members

- Protected Member Functions inherited from wibble::commandline::Engine
void addWithoutAna (Option *o)
 
void addWithoutAna (const std::vector< Option *> &o)
 
void add (const std::string &alias, Engine *o)
 
void rebuild ()
 
std::pair< ArgList::iterator, bool > parseFirstIfKnown (ArgList &list, ArgList::iterator begin)
 Handle the commandline switch at 'begin'. More...
 
ArgList::iterator parseKnownSwitches (ArgList &list, ArgList::iterator begin)
 Parse all known Options and leave the rest in list. More...
 
ArgList::iterator parseList (ArgList &list)
 Parse the list of arguments, starting at the beginning and removing the arguments it successfully parses. More...
 
ArgList::iterator parse (ArgList &list, ArgList::iterator begin)
 Parse all the switches in list, leaving only the non-switch arguments or the arguments following "--". More...
 
 Engine (MemoryManager *mman=0, const std::string &name=std::string(), const std::string &usage=std::string(), const std::string &description=std::string(), const std::string &longDescription=std::string())
 

Detailed Description

Parser for commandline arguments, with builting help functions.

Constructor & Destructor Documentation

◆ StandardParser()

wibble::commandline::StandardParser::StandardParser ( const std::string &  appname,
const std::string &  version 
)
inline

Member Function Documentation

◆ outputHelp()

void wibble::commandline::StandardParser::outputHelp ( std::ostream &  out)

◆ parse()

bool wibble::commandline::StandardParser::parse ( int  argc,
const char *  argv[] 
)

Member Data Documentation

◆ help

BoolOption* wibble::commandline::StandardParser::help

Referenced by withCommands().

◆ helpGroup

OptionGroup* wibble::commandline::StandardParser::helpGroup

◆ m_version

std::string wibble::commandline::StandardParser::m_version
protected

◆ version

BoolOption* wibble::commandline::StandardParser::version

Referenced by withCommands().


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