ROSE  0.11.96.11
Public Types | Static Public Member Functions | Protected Member Functions | List of all members
Rose::CommandLine::IntervalParser< Interval > Class Template Reference

Description

template<class Interval>
class Rose::CommandLine::IntervalParser< Interval >

Parse an interval.

An interval is specified in one of the following forms, where N and M are non-negative integers:

The integers can be specified in decimal, octal, hexadecimal, or binary using the usual C/C++ syntax.

Definition at line 32 of file IntervalParser.h.

#include <IntervalParser.h>

Inheritance diagram for Rose::CommandLine::IntervalParser< Interval >:
Inheritance graph
[legend]
Collaboration diagram for Rose::CommandLine::IntervalParser< Interval >:
Collaboration graph
[legend]

Public Types

using Ptr = Sawyer::SharedPointer< IntervalParser >
 Shared-ownership pointer to an IntervalParser. More...
 
- Public Types inherited from Sawyer::CommandLine::ValueParser
typedef SharedPointer< ValueParserPtr
 Reference counting pointer for this class.
 

Static Public Member Functions

static Ptr instance ()
 Default allocating constructor.
 
static Ptr instance (const Sawyer::CommandLine::ValueSaver::Ptr &valueSaver)
 Allocating constructor.
 
static std::string docString (const std::string &interval="interval", const std::string &value="value")
 Runtime documentation.
 
static Interval parse (const char *input, const char **rest)
 Parse an interval from a C string. More...
 
static Interval parse (const std::string &input)
 Parse an interval from a C++ string. More...
 
static std::string toString (const Interval &interval)
 Unparse an interval to a string.
 

Protected Member Functions

 IntervalParser (const Sawyer::CommandLine::ValueSaver::Ptr &valueSaver)
 
- 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...
 

Member Typedef Documentation

◆ Ptr

template<class Interval >
using Rose::CommandLine::IntervalParser< Interval >::Ptr = Sawyer::SharedPointer<IntervalParser>

Shared-ownership pointer to an IntervalParser.

See Shared ownership.

Definition at line 43 of file IntervalParser.h.

Member Function Documentation

◆ parse() [1/2]

template<class Interval >
static Interval Rose::CommandLine::IntervalParser< Interval >::parse ( const char *  input,
const char **  rest 
)
inlinestatic

Parse an interval from a C string.

Tries to parse an interval from the input string, and if successful adjusts rest to point to the first character beyond what was parsed. If a syntax error occurs, then an std::runtime_error is thrown.

Definition at line 75 of file IntervalParser.h.

Referenced by Rose::CommandLine::IntervalParser< Interval >::parse().

Here is the caller graph for this function:

◆ parse() [2/2]

template<class Interval >
static Interval Rose::CommandLine::IntervalParser< Interval >::parse ( const std::string &  input)
inlinestatic

Parse an interval from a C++ string.

Tries to parse an interval from the input string. The string may contain leading and trailing white space, but any extra characters will cause a syntax error. Syntax errors are reported by throwing std::runtime_error. Since the underlying parsing is done on C strings, this function is ill-defined when the input contains NUL characters.

Definition at line 188 of file IntervalParser.h.

References Rose::StringUtility::cEscape(), and Rose::CommandLine::IntervalParser< Interval >::parse().

Here is the call graph for this function:

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