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

Description

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

Parses an integer and converts it to numeric type T.

Matches an 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 strtoll function, plus trailing white space.

See also
integerParser factory, and Command line parser factories.

Definition at line 980 of file util/Sawyer/CommandLine.h.

#include <CommandLine.h>

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

Public Types

typedef SharedPointer< IntegerParserPtr
 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. More...
 
static Ptr instance (const ValueSaver::Ptr &valueSaver)
 Allocating constructor. More...
 

Protected Member Functions

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

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ IntegerParser() [1/2]

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

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 983 of file util/Sawyer/CommandLine.h.

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

Here is the caller graph for this function:

◆ IntegerParser() [2/2]

template<typename T >
Sawyer::CommandLine::IntegerParser< T >::IntegerParser ( const ValueSaver::Ptr valueSaver)
inlineexplicitprotected

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 986 of file util/Sawyer/CommandLine.h.

Member Function Documentation

◆ instance() [1/2]

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

Allocating constructor.

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

See also
Command line parser factories

Definition at line 997 of file util/Sawyer/CommandLine.h.

Referenced by Sawyer::CommandLine::integerParser().

Here is the caller graph for this function:

◆ instance() [2/2]

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

Allocating constructor.

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

See also
Command line parser factories

Definition at line 1005 of file util/Sawyer/CommandLine.h.

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

Here is the call graph for this function:

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