gatb.core-API-0.0.0
IOptionsParser Class Referenceabstract

Parser interface that analyzes command line options. More...

#include <IOptionsParser.hpp>

Inheritance diagram for IOptionsParser:
Inheritance graph

Classes

struct  Result
 

Public Member Functions

virtual const std::string & getName () const =0
 
virtual void setName (const std::string &name)=0
 
virtual void setVisible (bool status)=0
 
virtual bool isVisible () const =0
 
virtual const std::string & getHelp () const =0
 
virtual void setHelp (const std::string &help)=0
 
virtual misc::IPropertiesparse (int argc, char **argv)=0
 
virtual misc::IPropertiesparseString (const std::string &s)=0
 
virtual misc::IPropertiesgetProperties ()=0
 
virtual bool saw (const std::string &name) const =0
 
virtual void push_back (IOptionsParser *parser, size_t expandDepth=0, bool visibility=true)=0
 
virtual void push_front (IOptionsParser *parser, size_t expandDepth=0, bool visibility=true)=0
 
virtual IOptionsParsergetParser (const std::string &name)=0
 
virtual std::list< IOptionsParser * > & getParsers ()=0
 
virtual misc::IPropertiesgetDefaultProperties ()=0
 
virtual void accept (IOptionsParserVisitor &visitor, size_t depth=0)=0
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

Parser interface that analyzes command line options.

Client can use this class for registering command line options specifications and then can use it for parsing some command line options, typically given as arguments of the 'main' function.

This interface is intended to be implemented as a Composite design pattern, so we will have a 'leaf' implementation (see Option) and a 'composite' implementation (see OptionsParser)

Member Function Documentation

virtual void accept ( IOptionsParserVisitor visitor,
size_t  depth = 0 
)
pure virtual

Visitor design pattern.

Implemented in Option, and OptionsParser.

virtual misc::IProperties* getDefaultProperties ( )
pure virtual

Return the default properties

Returns
the default properties.

Implemented in OptionsParser.

virtual const std::string& getHelp ( ) const
pure virtual

Get help.

Implemented in OptionsParser.

virtual const std::string& getName ( ) const
pure virtual

Get name.

Implemented in OptionsParser.

virtual IOptionsParser* getParser ( const std::string &  name)
pure virtual

Get a parser given its name.

Parameters
[in]name: name of the parser to be retrieved
Returns
the parser instance if found, 0 otherwise.

Implemented in Option, and OptionsParser.

virtual std::list<IOptionsParser*>& getParsers ( )
pure virtual

Get the children parsers.

Returns
a list of parsers.

Implemented in OptionsParser.

virtual misc::IProperties* getProperties ( )
pure virtual

Return the properties found during parsing.

Returns
the parsed properties.

Implemented in OptionsParser.

virtual bool isVisible ( ) const
pure virtual

Get visibility status.

Implemented in OptionsParser.

virtual misc::IProperties* parse ( int  argc,
char **  argv 
)
pure virtual

Perform the analyze of the arguments.

Parameters
[in]argc: number of command line arguments.
[in]argv: table of arguments
Returns
object with information about the parsing.

Implemented in OptionsParser.

virtual misc::IProperties* parseString ( const std::string &  s)
pure virtual

Perform the analyze of the arguments.

Parameters
[in]s: string containing the options to be parsed
Returns
object with information about the parsing.

Implemented in OptionsParser.

virtual void push_back ( IOptionsParser parser,
size_t  expandDepth = 0,
bool  visibility = true 
)
pure virtual

Add a parser child at the back of known parsers.

Parameters
[in]parser: the child parser
[in]expandDepth: while depth is less than expandDepth, put all the children and not the 'parser' itself.
[in]visibility: visibility status.

Implemented in OptionsParser.

virtual void push_front ( IOptionsParser parser,
size_t  expandDepth = 0,
bool  visibility = true 
)
pure virtual

Add a parser child at the front of known parsers.

Parameters
[in]parser: the child parser
[in]expandDepth: while depth is less than expandDepth, put all the children and not the 'parser' itself.
[in]visibility: visibility status.

Implemented in OptionsParser.

virtual bool saw ( const std::string &  name) const
pure virtual

Tells whether an option has been seen during parsing.

Parameters
[in]name: name of the option to be checked
Returns
true if option was found during parsing, false otherwise.

Implemented in OptionsParser.

virtual void setHelp ( const std::string &  help)
pure virtual

Set help

Parameters
[in]help: the help string

Implemented in OptionsParser.

virtual void setName ( const std::string &  name)
pure virtual

Associate a name to the parser.

Parameters
[in]name: the name of the parser.

Implemented in OptionsParser.

virtual void setVisible ( bool  status)
pure virtual

Set visibility status.

Implemented in OptionsParser.


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