MeVisLab Toolbox Reference
ml::ParserBase Class Reference

Basic parser class from which special parser classes can be derived for parsing persistent state strings. More...

#include <mlParserBase.h>

Inheritance diagram for ml::ParserBase:
ml::BaseItemParser ml::ListParser

Public Types

enum  { kNoError = 0 , kEmptyString , kNumBaseErrorCodes , kEndOfSource = -1 }
 Error codes. More...
 

Public Member Functions

 ParserBase ()
 Constructor.
 
virtual ~ParserBase ()
 Make destructor virtual to avoid warnings.
 
virtual int init (const char *source)
 Initialize parser and proceed to first non-whitespace character.
 
const chargetCurrentPos ()
 Get current parser position.
 
bool endOfSource ()
 Return end-of-source flag.
 
virtual const chargetErrorMessage (int errorCode)
 Get error string for errorCode.
 

Static Public Member Functions

static charnewString (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

void skipWhitespace ()
 Proceed to next non-whitespace character.
 

Protected Attributes

const char_source
 Source string.
 
const char_pNext
 Pointer to current parser position.
 
bool _eos
 End-of-string flag.
 

Detailed Description

Basic parser class from which special parser classes can be derived for parsing persistent state strings.

Definition at line 36 of file mlParserBase.h.

Member Enumeration Documentation

◆ anonymous enum

Error codes.

Enumerator
kNoError 
kEmptyString 

Source string null or empty.

kNumBaseErrorCodes 

Highest error code +1.

kEndOfSource 

End of source reached.

Definition at line 60 of file mlParserBase.h.

Constructor & Destructor Documentation

◆ ParserBase()

ml::ParserBase::ParserBase ( )
inline

Constructor.

Definition at line 41 of file mlParserBase.h.

◆ ~ParserBase()

virtual ml::ParserBase::~ParserBase ( )
inlinevirtual

Make destructor virtual to avoid warnings.

Definition at line 44 of file mlParserBase.h.

Member Function Documentation

◆ deleteString()

static void ml::ParserBase::deleteString ( char * str)
static

Dispose a string allocated with newString()

Referenced by ml::ListBase::deleteString().

◆ endOfSource()

bool ml::ParserBase::endOfSource ( )
inline

Return end-of-source flag.

Definition at line 54 of file mlParserBase.h.

◆ getCurrentPos()

const char * ml::ParserBase::getCurrentPos ( )
inline

Get current parser position.

Definition at line 51 of file mlParserBase.h.

◆ getErrorMessage()

virtual const char * ml::ParserBase::getErrorMessage ( int errorCode)
virtual

Get error string for errorCode.

Reimplemented in ml::BaseItemParser, and ml::ListParser.

◆ init()

virtual int ml::ParserBase::init ( const char * source)
virtual

Initialize parser and proceed to first non-whitespace character.

Returns kEmptyString for an empty or null source string.

Reimplemented in ml::ListParser.

◆ newString()

static char * ml::ParserBase::newString ( const std::string & str)
static

Convenience method to create a copy of the string str allocated on the heap.

This avoids passing STL strings between modules, which fails in Windows due to a bug in the VC++ implementation of the STL.

Referenced by ml::ListBase::newString().

◆ skipWhitespace()

void ml::ParserBase::skipWhitespace ( )
protected

Proceed to next non-whitespace character.

Member Data Documentation

◆ _eos

bool ml::ParserBase::_eos
protected

End-of-string flag.

Definition at line 88 of file mlParserBase.h.

◆ _pNext

const char* ml::ParserBase::_pNext
protected

Pointer to current parser position.

Definition at line 86 of file mlParserBase.h.

◆ _source

const char* ml::ParserBase::_source
protected

Source string.

Definition at line 84 of file mlParserBase.h.


The documentation for this class was generated from the following file: