MeVisLab Toolbox Reference
|
Parser class for parsing persistent state strings of list objects. More...
#include <mlListParser.h>
Public Types | |
enum | { kMissingOpenBracket = kNumBaseErrorCodes , kMissingCloseBracket , kUnmatchedQuote , kNumErrorCodes } |
Error codes. More... | |
Public Types inherited from ml::ParserBase | |
enum | { kNoError = 0 , kEmptyString , kNumBaseErrorCodes , kEndOfSource = -1 } |
Error codes. More... | |
Public Member Functions | |
ListParser ()=default | |
Constructor. | |
int | init (const char *source) override |
Initialize parser and proceed to first character of first item. | |
std::pair< int, std::string > | nextItem () |
Return a string to next item's substring Return codes: | |
const char * | getErrorMessage (int errorCode) override |
Get error string for errorCode. | |
Public Member Functions inherited from ml::ParserBase | |
ParserBase () | |
Constructor. | |
virtual | ~ParserBase () |
Make destructor virtual to avoid warnings. | |
const char * | getCurrentPos () |
Get current parser position. | |
bool | endOfSource () |
Return end-of-source flag. | |
Static Public Member Functions | |
static bool | needsQuote (const char *itemStr) |
Return true if itemStr needs to be quoted. | |
static bool | needsQuote (const std::string &itemStr) |
static std::string | quoteString (const std::string &itemStr) |
Static Public Member Functions inherited from ml::ParserBase | |
static char * | newString (const std::string &str) |
Convenience method to create a copy of the string str allocated on the heap. | |
static void | deleteString (char *str) |
Dispose a string allocated with newString() | |
Protected Member Functions | |
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. | |
Protected Member Functions inherited from ml::ParserBase | |
void | skipWhitespace () |
Proceed to next non-whitespace character. | |
Additional Inherited Members | |
Protected Attributes inherited from ml::ParserBase | |
const char * | _source |
Source string. | |
const char * | _pNext |
Pointer to current parser position. | |
bool | _eos |
End-of-string flag. | |
Parser class for parsing persistent state strings of list objects.
Definition at line 39 of file mlListParser.h.
Error codes.
Enumerator | |
---|---|
kMissingOpenBracket | |
kMissingCloseBracket | |
kUnmatchedQuote | |
kNumErrorCodes | Highest error code +1. |
Definition at line 66 of file mlListParser.h.
|
default |
Constructor.
Get error string for errorCode.
Reimplemented from ml::ParserBase.
Initialize parser and proceed to first character of first item.
Return codes:
Reimplemented from ml::ParserBase.
Return true if itemStr needs to be quoted.
std::pair< int, std::string > ml::ListParser::nextItem | ( | ) |
Return a string to next item's substring Return codes:
|
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.