SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2013 Evgeniy Andreev (gsomix) 00008 */ 00009 00010 #ifndef __PARSER_H__ 00011 #define __PARSER_H__ 00012 00013 #include <shogun/lib/SGVector.h> 00014 #include <shogun/lib/Tokenizer.h> 00015 00016 namespace shogun 00017 { 00019 class CParser : public CSGObject 00020 { 00021 public: 00023 CParser(); 00024 00030 CParser(SGVector<char> string, CTokenizer* tokenizer); 00031 00033 virtual ~CParser(); 00034 00039 virtual bool has_next(); 00040 00042 virtual void skip_token(); 00043 00045 virtual SGVector<char> read_string(); 00046 00048 virtual SGVector<char> read_cstring(); 00049 00052 virtual bool read_bool(); 00053 virtual char read_char(); 00054 virtual uint8_t read_byte(); 00055 virtual int16_t read_short(); 00056 virtual uint16_t read_word(); 00057 virtual int32_t read_int(); 00058 virtual uint32_t read_uint(); 00059 virtual int64_t read_long(); 00060 virtual uint64_t read_ulong(); 00061 virtual float32_t read_short_real(); 00062 virtual float64_t read_real(); 00063 virtual floatmax_t read_long_real(); 00065 00070 void set_tokenizer(CTokenizer* tokenizer); 00071 00076 void set_text(SGVector<char> text); 00077 00079 virtual const char* get_name() const { return "Parser"; } 00080 00081 private: 00083 void init(); 00084 00085 private: 00087 SGVector<char> m_text; 00088 00090 CTokenizer* m_tokenizer; 00091 }; 00092 00093 } 00094 00095 #endif