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

Description

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

Parses a positive integer and converts it to numeric type T.

Matches a positive integer in the mathematical sense in C++ decimal, octal, or hexadecimal format, and attempts to convert it to the type T. If the integer cannot be converted to type T then an std::range_error is thrown, which is most likely caught by higher layers of the library and converted to an std::runtime_error with additional information about the failure. The syntax is that which is recognized by the strtoull function except that a leading minus sign is not allowed (yes, strtoull parses negative numbers and returns them as unsigned), plus trailing white space.

See also
positiveIntegerParser factory, and Command line parser factories.

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

#include <Sawyer/CommandLine.h>

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

Public Types

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

Static Public Member Functions

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

Protected Member Functions

 PositiveIntegerParser ()
 Constructor for derived classes.
 
 PositiveIntegerParser (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.
 

Additional Inherited 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.
 

Member Typedef Documentation

◆ Ptr

Reference counting pointer for this class.

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

Constructor & Destructor Documentation

◆ PositiveIntegerParser() [1/2]

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

Constructor for derived classes.

Non-subclass users should use instance instead.

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

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

◆ PositiveIntegerParser() [2/2]

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

Constructor for derived classes.

Non-subclass users should use instance instead.

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

Member Function Documentation

◆ instance() [1/2]

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

Allocating constructor.

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

See also
Command line parser factories

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

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

◆ instance() [2/2]

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

Allocating constructor.

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

See also
Command line parser factories

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

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


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