ROSE 0.11.145.192
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Sawyer::CommandLine::EnumParser< T > Class Template Reference

Description

template<typename T>
class Sawyer::CommandLine::EnumParser< T >

Parses an enumerated constant.

Parses one of the strings added via with and returns the associated enumerated constant. The template parameter T is the enum type. Returns A ParsedValue whose value if type T. This parser uses StringSetParser, thus it prefers to match enum members with the longest names.

See also
Command line parser factories

Definition at line 1276 of file Sawyer/CommandLine.h.

#include <Sawyer/CommandLine.h>

Inheritance diagram for Sawyer::CommandLine::EnumParser< T >:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::CommandLine::EnumParser< T >:
Collaboration graph
[legend]

Public Types

typedef SharedPointer< EnumParserPtr
 Reference counting pointer for this class.
 
- Public Types inherited from Sawyer::CommandLine::ValueParser
typedef SharedPointer< ValueParserPtr
 Reference counting pointer for this class.
 

Public Member Functions

Ptr with (const std::string &name, T value)
 Adds enum members.
 
- Public Member Functions inherited from Sawyer::CommandLine::ValueParser
ParsedValue matchString (const std::string &)
 Parse the entire string and return a value.
 
ParsedValue match (Cursor &)
 Parse a value from the beginning of the specified string.
 
Ptr valueSaver (const ValueSaver::Ptr &f)
 Property: functor responsible for saving a parsed value in user storage.
 
const ValueSaver::Ptr valueSaver () const
 Property: functor responsible for saving a parsed value in user storage.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (const SharedObject &)
 Assignment.
 
- Public Member Functions inherited from Sawyer::SharedFromThis< ValueParser >
SharedPointer< ValueParser > sharedFromThis ()
 Create a shared pointer from this.
 
SharedPointer< const ValueParser > sharedFromThis () const
 Create a shared pointer from this.
 

Static Public Member Functions

static Ptr instance ()
 Allocating constructor.
 
static Ptr instance (const ValueSaver::Ptr &valueSaver)
 Allocating constructor.
 

Protected Member Functions

 EnumParser ()
 Constructor for derived classes.
 
 EnumParser (const ValueSaver::Ptr &valueSaver)
 Constructor for derived classes.
 
- Protected Member Functions inherited from Sawyer::CommandLine::ValueParser
 ValueParser ()
 Constructor for derived classes.
 
 ValueParser (const ValueSaver::Ptr &valueSaver)
 Constructor for derived classes.
 

Member Typedef Documentation

◆ Ptr

template<typename T >
typedef SharedPointer<EnumParser> Sawyer::CommandLine::EnumParser< T >::Ptr

Reference counting pointer for this class.

Definition at line 1287 of file Sawyer/CommandLine.h.

Constructor & Destructor Documentation

◆ EnumParser() [1/2]

template<typename T >
Sawyer::CommandLine::EnumParser< T >::EnumParser ( )
inlineprotected

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 1281 of file Sawyer/CommandLine.h.

Referenced by Sawyer::CommandLine::EnumParser< T >::instance().

◆ EnumParser() [2/2]

template<typename T >
Sawyer::CommandLine::EnumParser< T >::EnumParser ( const ValueSaver::Ptr valueSaver)
inlineprotected

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 1284 of file Sawyer/CommandLine.h.

Member Function Documentation

◆ instance() [1/2]

template<typename T >
static Ptr Sawyer::CommandLine::EnumParser< T >::instance ( )
inlinestatic

Allocating constructor.

Returns a pointer to a new EnumParser object. Uses will most likely want to use the enumParser factory instead, which requires less typing.

See also
Command line parser factories

Definition at line 1292 of file Sawyer/CommandLine.h.

Referenced by Sawyer::CommandLine::enumParser(), Sawyer::CommandLine::enumParser(), Sawyer::CommandLine::enumParser(), Sawyer::CommandLine::enumParser(), and Sawyer::CommandLine::enumParser().

◆ instance() [2/2]

template<typename T >
static Ptr Sawyer::CommandLine::EnumParser< T >::instance ( const ValueSaver::Ptr valueSaver)
inlinestatic

Allocating constructor.

Returns a pointer to a new EnumParser object. Uses will most likely want to use the enumParser factory instead, which takes the same arguments, but requires less typing.

See also
Command line parser factories

Definition at line 1297 of file Sawyer/CommandLine.h.

References Sawyer::CommandLine::EnumParser< T >::EnumParser(), and Sawyer::CommandLine::ValueParser::valueSaver().

◆ with()

template<typename T >
Ptr Sawyer::CommandLine::EnumParser< T >::with ( const std::string &  name,
value 
)
inline

Adds enum members.

Inserts an additional enumeration constant and its string name.

Definition at line 1300 of file Sawyer/CommandLine.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert(), and Sawyer::SharedFromThis< ValueParser >::sharedFromThis().


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