MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00005 00010 // 00011 // - ParserBase is a base class from which special parser classes can be derived. 00012 // - ListParser (derived from ParserBase) is a parser class for parsing persistent 00013 // state strings of list objects. 00014 // - BaseItemParser (derived from ParserBase) is a parser class for BaseItem strings. 00015 //---------------------------------------------------------------------------------- 00016 00017 #ifndef __mlListParser_H 00018 #define __mlListParser_H 00019 00020 00021 // ML-includes 00022 #ifndef __mlBaseInit_H 00023 #include "mlBaseInit.h" 00024 #endif 00025 #ifndef __mlParserBase_H 00026 #include "mlParserBase.h" 00027 #endif 00028 00029 // For backward compatibility also include BaseItemParser. 00030 #ifndef __mlBaseItemParser_H 00031 #include "mlBaseItemParser.h" 00032 #endif 00033 00034 00035 ML_START_NAMESPACE 00036 00037 // ------------------------------------------------------------------ 00038 // Class ListParser 00039 // ------------------------------------------------------------------ 00040 00042 class MLBASEEXPORT ListParser : public ParserBase 00043 { 00044 public: 00045 00047 ListParser () : ParserBase() {} 00048 00049 00056 virtual int init (const char *source); 00057 00063 int nextItemString (char *&itemString); 00064 00066 virtual const char *getErrorMessage (int errorCode); 00067 00069 enum { 00070 kMissingOpenBracket = kNumBaseErrorCodes, 00071 kMissingCloseBracket, 00072 kUnmatchedQuote, 00073 kNumErrorCodes 00074 }; 00075 00076 00078 static bool needsQuote (char *itemStr); 00079 00081 static char *quoteString (char *itemStr); 00082 00083 00084 protected: 00085 00090 int unquoteString (std::string &itemString); 00091 00092 }; 00093 00094 ML_END_NAMESPACE 00095 00096 #endif // __mlListParser_H 00097 00098