ROSE  0.11.96.11
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 <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. More...
 
- Public Types inherited from Rose::CommandLine::SuffixMultiplierParser< uint64_t >
enum  Preferred
 
using Ptr = Sawyer::SharedPointer< SuffixMultiplierParser >
 Shared-ownership pointer to a SuffixMultiplierParser. More...
 
- 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. More...
 
- 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. More...
 
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. More...
 
bool extendedSyntax () const
 Property: Allow extended syntax for numberic values. More...
 
Ptr extendedSyntax (bool b)
 Property: Allow extended syntax for numberic values. More...
 
- 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...
 

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. More...
 
 ValueParser (const ValueSaver::Ptr &valueSaver)
 Constructor for derived classes. More...
 

Member Typedef Documentation

◆ Ptr

Shared-ownership pointer to a DurationParser.

See Shared ownership.

Definition at line 20 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: