ROSE 0.11.145.192
|
Parses a list of values.
Parses a list of values separated by specified regular expressions. Each member of the list may have its own parser and following separator. The final parser and separator are reused as often as necessary. The return value is a ParsedValue whose value is an STL list
with members that are the ParsedValue objects return by the list element parsers.
Definition at line 1319 of file Sawyer/CommandLine.h.
#include <Sawyer/CommandLine.h>
Public Types | |
typedef SharedPointer< ListParser > | Ptr |
Reference counting pointer for this class. | |
typedef std::list< ParsedValue > | ValueList |
Value type for list ParsedValue. | |
Public Types inherited from Sawyer::CommandLine::ValueParser | |
typedef SharedPointer< ValueParser > | Ptr |
Reference counting pointer for this class. | |
Public Member Functions | |
Ptr | nextMember (const ValueParser::Ptr &elmtType, const std::string &separatorRe="[,;:]\\s*") |
Specifies element type and separator. | |
Ptr | limit (size_t minLength, size_t maxLength) |
Specify limits for the number of values parsed. | |
Ptr | limit (size_t maxLength) |
Specify limits for the number of values parsed. | |
Ptr | exactly (size_t length) |
Specify limits for the number of values parsed. | |
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 . | |
Static Public Member Functions | |
static Ptr | instance (const ValueParser::Ptr &firstElmtType, const std::string &separatorRe="[,;:]\\s*") |
Allocating constructor. | |
Protected Member Functions | |
ListParser (const ValueParser::Ptr &firstElmtType, const std::string &separatorRe) | |
Constructor for derived classes. | |
Protected Member Functions inherited from Sawyer::CommandLine::ValueParser | |
ValueParser () | |
Constructor for derived classes. | |
ValueParser (const ValueSaver::Ptr &valueSaver) | |
Constructor for derived classes. | |
Reference counting pointer for this class.
Definition at line 1333 of file Sawyer/CommandLine.h.
typedef std::list<ParsedValue> Sawyer::CommandLine::ListParser::ValueList |
Value type for list ParsedValue.
Definition at line 1336 of file Sawyer/CommandLine.h.
|
inlineprotected |
Constructor for derived classes.
Non-subclass users should use instance instead.
Definition at line 1327 of file Sawyer/CommandLine.h.
|
inlinestatic |
Allocating constructor.
The firstElmtType
is the parser for the first value (and the remaining values also if no subsequent parser is specified), and the separatorRe
is the regular expression describing how values of this type are separated from subsequent values. The default separator is a comma, semicolon, or colon followed by zero or more white space characters. Users will most likely want to use the listParser factory instead, which takes the same arguments but requires less typing.
Definition at line 1345 of file Sawyer/CommandLine.h.
|
inline |
Specifies element type and separator.
Adds another element type and separator to this parser. The specified values are also used for all the following list members unless a subsequent type and separator are supplied. I.e., the final element type and separator are repeated as necessary when parsing. The default separator is a comma, semicolon, or colon followed by zero ore more white space characters.
Definition at line 1355 of file Sawyer/CommandLine.h.
References Sawyer::SharedPointer< T >::dynamicCast().
Ptr Sawyer::CommandLine::ListParser::limit | ( | size_t | minLength, |
size_t | maxLength | ||
) |
Specify limits for the number of values parsed.
By default, a list parser parses zero or more values with no limit. The limit method provides separate lower and upper bounds (the one argument version sets only the upper bound), and the exactly method is a convenience to set the lower and upper bound to the same value.
|
inline |
Specify limits for the number of values parsed.
By default, a list parser parses zero or more values with no limit. The limit method provides separate lower and upper bounds (the one argument version sets only the upper bound), and the exactly method is a convenience to set the lower and upper bound to the same value.
Definition at line 1367 of file Sawyer/CommandLine.h.
References limit().
Referenced by limit().
|
inline |
Specify limits for the number of values parsed.
By default, a list parser parses zero or more values with no limit. The limit method provides separate lower and upper bounds (the one argument version sets only the upper bound), and the exactly method is a convenience to set the lower and upper bound to the same value.
Definition at line 1368 of file Sawyer/CommandLine.h.