#include <stringparser.h>
Collaboration diagram for StringArgs:

Public Methods | |
| StringArgs (const StringParser& parser, StringParser::argptr b, StringParser::argptr e) | |
| StringArgs (const StringParser& parser, const string& s) | |
| StringArgs (const StringArgs& other) | |
| Copy constructor. More... | |
| bool | empty () const |
| Returns true if no arguments remain. More... | |
| bool | oneremaining () const |
| Returns true if exactly one argument remains. More... | |
| template<classT> T | next (const T& default_val) |
| Family of parses based on type of the given default. More... | |
| template<classT> T* | next (const T& default_val, T*& ptr) |
| Version returning a pointer instead of a value. More... | |
| template<classT> bool | nextis (const T& test_val) |
| Consumes only if equal to given value, and returns true if so. More... | |
| template<classT> bool | lookaheadone (const T& test_val) |
| Returns true if the next argument after this one is equal the given value; rarely needed. More... | |
| StringArgs | recursiveparser () |
| Returns a new parser parsing the substructure of the current argument. More... | |
Public Attributes | |
| const StringParser& | p |
| Provided as a public service to those needing a parser; avoid if possible. More... | |
An argument of this type is good for a function which constructs an object from a string specification. If you're starting with a simple string, you can use the string constructor below; otherwise (e.g. if starting with a pre-segmented vector of strings) use the iterator-based constructor. An object from this class can be passed around as a reference argument to various other classes, each of whom can consume some of the tokens until all are gone.
To consume a token, supply to next() a default value of the type you would like returned; this value will be returned if no arguments remain. Even if no default is meaningful, supply one anyway but first check that the arglist is not empty(), which will ensure that the default is not used.
Definition at line 134 of file stringparser.h.
|
|
Definition at line 143 of file stringparser.h. |
|
|
Definition at line 146 of file stringparser.h. |
|
|
Copy constructor.
Definition at line 153 of file stringparser.h. Referenced by recursiveparser(). |
|
|
Returns true if no arguments remain.
Definition at line 167 of file stringparser.h. Referenced by ValueGeneratorFactory::create(), lookaheadone(), next(), nextis(), and RetinalObjectStringArgs::vars(). |
|
||||
|
Returns true if the next argument after this one is equal the given value; rarely needed.
Definition at line 211 of file stringparser.h. Referenced by RetinalObjectStringArgs::vars(). |
|
||||||
|
Version returning a pointer instead of a value.
Definition at line 186 of file stringparser.h. |
|
||||
|
Family of parses based on type of the given default.
Definition at line 174 of file stringparser.h. Referenced by ValueGeneratorFactory::create(), KernelFactory::create(), NamedValueGenerators::create(), WorldViews::create_object(), RetinalObjectStringArgs::parsed_next(), recursiveparser(), and RetinalObjectStringArgs::vars(). |
|
||||
|
Consumes only if equal to given value, and returns true if so.
Definition at line 196 of file stringparser.h. Referenced by ValueGeneratorFactory::create(), and RetinalObjectStringArgs::vars(). |
|
|
Returns true if exactly one argument remains.
Definition at line 170 of file stringparser.h. Referenced by ValueGeneratorFactory::create(). |
|
|
Returns a new parser parsing the substructure of the current argument.
Definition at line 221 of file stringparser.h. Referenced by NamedValueGenerators::create(). |
|
|
Provided as a public service to those needing a parser; avoid if possible.
Definition at line 141 of file stringparser.h. |
1.2.1 written by Dimitri van Heesch,
© 1997-2000