Parser class for parsing persistent state strings of list objects.
More...
#include <mlListParser.h>
|
static bool | needsQuote (const char *itemStr) |
| Return true if itemStr needs to be quoted. More...
|
|
static bool | needsQuote (const std::string &itemStr) |
|
static std::string | quoteString (const std::string &itemStr) |
|
static char * | newString (const std::string &str) |
| Convenience method to create a copy of the string str allocated on the heap. More...
|
|
static void | deleteString (char *str) |
| Dispose a string allocated with newString() More...
|
|
|
int | unquoteString (std::string &itemString) |
| Convert quoted string to original, unescaped character sequence Assumes that _pNext points to a leading quote, proceeds to the first character after the terminating quote. More...
|
|
void | skipWhitespace () |
| Proceed to next non-whitespace character. More...
|
|
Parser class for parsing persistent state strings of list objects.
Definition at line 39 of file mlListParser.h.
◆ anonymous enum
Error codes.
Enumerator |
---|
kMissingOpenBracket | |
kMissingCloseBracket | |
kUnmatchedQuote | |
kNumErrorCodes | Highest error code +1.
|
Definition at line 66 of file mlListParser.h.
◆ ListParser()
ml::ListParser::ListParser |
( |
| ) |
|
|
default |
◆ getErrorMessage()
const char* ml::ListParser::getErrorMessage |
( |
int |
errorCode | ) |
|
|
overridevirtual |
◆ init()
int ml::ListParser::init |
( |
const char * |
source | ) |
|
|
overridevirtual |
Initialize parser and proceed to first character of first item.
Return codes:
- kEmptyString for an empty or null source string,
- kEndOfSource for an empty list ("[]")
- kMissingOpenBracket for a non-empty string not beginning with '['
- kMissingCloseBracket for a string containing only "["
Reimplemented from ml::ParserBase.
Referenced by ml::ListTemplate< T >::setPersistentState().
◆ needsQuote() [1/2]
static bool ml::ListParser::needsQuote |
( |
const char * |
itemStr | ) |
|
|
static |
Return true if itemStr needs to be quoted.
◆ needsQuote() [2/2]
static bool ml::ListParser::needsQuote |
( |
const std::string & |
itemStr | ) |
|
|
static |
◆ nextItem()
std::pair<int, std::string> ml::ListParser::nextItem |
( |
| ) |
|
◆ quoteString()
static std::string ml::ListParser::quoteString |
( |
const std::string & |
itemStr | ) |
|
|
static |
◆ unquoteString()
int ml::ListParser::unquoteString |
( |
std::string & |
itemString | ) |
|
|
protected |
Convert quoted string to original, unescaped character sequence Assumes that _pNext points to a leading quote, proceeds to the first character after the terminating quote.
Return kUnmatchedQuote if strings ends without terminating quote.
The documentation for this class was generated from the following file: