ROSE 0.11.145.192
|
Parses an output color specification.
This parser is used by Sawyer::CommandLine when parsing command-line switches. For instance, many ROSE tools have a "--color" switch. The canonical documentation for this parser comes from its docString function. In short, it parses one or two words separated by a comma, the words being when to use colorized output ("off", "on", "auto") and the basic theme ("dark", or "light").
#include <Rose/Color.h>
Public Types | |
typedef Sawyer::SharedPointer< ColorizationParser > | Ptr |
Shared ownership pointer to a ColorizationParser. | |
Public Types inherited from Sawyer::CommandLine::ValueParser | |
typedef SharedPointer< ValueParser > | Ptr |
Reference counting pointer for this class. | |
Static Public Member Functions | |
static Ptr | instance () |
Allocating constructor. | |
static Ptr | instance (const Sawyer::CommandLine::ValueSaver::Ptr &valueSaver) |
Allocating constructor. | |
static std::string | docString () |
Documentation for parser. | |
static Colorization | parse (const char *input, const char **rest) |
Parse a colorized output specification from a C string. | |
static Colorization | parse (const std::string &input) |
Parse a colorized output specification from a C++ string. | |
Protected Member Functions | |
ColorizationParser (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. | |
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. | |
SharedObject & | operator= (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 . | |
Shared ownership pointer to a ColorizationParser.
See Shared ownership.
|
inlineprotected |
|
inlineprotected |
|
inlinestatic |
|
inlinestatic |
Allocating constructor.
Definition at line 77 of file Color.h.
References Sawyer::CommandLine::ValueParser::valueSaver().
|
static |
Parse a colorized output specification from a C string.
Tries to parse a colorized output specification 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.
|
static |
Parse a colorized output specification from a C++ string.
Tries to parse a colorized output specification 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 bytes.