ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::CommandLine::DurationParser Class Reference

Description

Command-line parser for durations.

Definition at line 10 of file DurationParser.h.

#include <Rose/CommandLine/DurationParser.h>

Inheritance diagram for Rose::CommandLine::DurationParser:
Inheritance graph
[legend]
Collaboration diagram for Rose::CommandLine::DurationParser:
Collaboration graph
[legend]

Public Types

using Ptr = Sawyer::SharedPointer< DurationParser >
 Shared-ownership pointer to a DurationParser.
 
- Public Types inherited from Rose::CommandLine::SuffixMultiplierParser< uint64_t >
enum  Preferred
 
using Ptr = Sawyer::SharedPointer< SuffixMultiplierParser >
 Shared-ownership pointer to a Rose::CommandLine::SuffixMultiplierParser.
 
- Public Types inherited from Sawyer::CommandLine::ValueParser
typedef SharedPointer< ValueParserPtr
 Reference counting pointer for this class.
 

Public Member Functions

std::string toString (const Sawyer::Optional< uint64_t > &seconds)
 Convert seconds to a parsable string.
 
- Public Member Functions inherited from Rose::CommandLine::SuffixMultiplierParser< uint64_t >
uint64_t parse (const char *input, const char **rest)
 Parse from a C string.
 
uint64_t parse (const std::string &input)
 Parse from a C++ string.
 
std::string toString (uint64_t value)
 Unparse to a string.
 
Ptr with (const std::string &suffix, uint64_t multiplier, Preferred preferred=Preferred::YES)
 Insert a suffix definition.
 
Ptr with (const std::string &suffix, uint64_t multiplier, const std::string &alias1, const std::string &alias2="", const std::string &alias3="", const std::string &alias4="")
 Insert a suffix definition.
 
bool extendedSyntax () const
 Property: Allow extended syntax for numberic values.
 
Ptr extendedSyntax (bool b)
 Property: Allow extended syntax for numberic values.
 
- 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 ()
 Default allocating constructor.
 
static Ptr instance (const Sawyer::CommandLine::ValueSaver::Ptr &)
 Allocating constructor.
 
static std::string docString ()
 Runtime documentation.
 
- Static Public Member Functions inherited from Rose::CommandLine::SuffixMultiplierParser< uint64_t >
static Ptr instance ()
 Default allocating constructor.
 
static Ptr instance (const Sawyer::CommandLine::ValueSaver::Ptr &valueSaver)
 Allocating constructor.
 
static std::pair< uint64_t, uint64_t > quotientRemainder (uint64_t product, uint64_t divisor, uint64_t)
 
static std::pair< uint64_t, uint64_t > quotientRemainder (uint64_t product, uint64_t divisor, double)
 

Protected Member Functions

 DurationParser (const Sawyer::CommandLine::ValueSaver::Ptr &valueSaver)
 
- Protected Member Functions inherited from Rose::CommandLine::SuffixMultiplierParser< uint64_t >
 SuffixMultiplierParser (const Sawyer::CommandLine::ValueSaver::Ptr &valueSaver)
 
- 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

Shared-ownership pointer to a DurationParser.

See Shared ownership.

Definition at line 20 of file DurationParser.h.

Constructor & Destructor Documentation

◆ DurationParser() [1/2]

Rose::CommandLine::DurationParser::DurationParser ( )
inlineprotected

Definition at line 13 of file DurationParser.h.

◆ DurationParser() [2/2]

Rose::CommandLine::DurationParser::DurationParser ( const Sawyer::CommandLine::ValueSaver::Ptr valueSaver)
inlineprotected

Definition at line 15 of file DurationParser.h.

Member Function Documentation

◆ toString()

std::string Rose::CommandLine::DurationParser::toString ( const Sawyer::Optional< uint64_t > &  seconds)

Convert seconds to a parsable string.

Instead of just returning the number of seconds, use days, hours, minutes, and seconds as appropriate.


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