SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Evgeniy Andreev (gsomix)
8  */
9 
10 #ifndef __PARSER_H__
11 #define __PARSER_H__
12 
13 #include <shogun/lib/config.h>
14 
15 #include <shogun/lib/SGVector.h>
16 #include <shogun/base/SGObject.h>
17 
18 namespace shogun
19 {
20 class CTokenizer;
21 
23 class CParser : public CSGObject
24 {
25 public:
27  CParser();
28 
34  CParser(SGVector<char> string, CTokenizer* tokenizer);
35 
37  virtual ~CParser();
38 
43  virtual bool has_next();
44 
46  virtual void skip_token();
47 
49  virtual SGVector<char> read_string();
50 
52  virtual SGVector<char> read_cstring();
53 
56  virtual bool read_bool();
57  virtual char read_char();
58  virtual uint8_t read_byte();
59  virtual int16_t read_short();
60  virtual uint16_t read_word();
61  virtual int32_t read_int();
62  virtual uint32_t read_uint();
63  virtual int64_t read_long();
64  virtual uint64_t read_ulong();
65  virtual float32_t read_short_real();
66  virtual float64_t read_real();
67  virtual floatmax_t read_long_real();
69 
74  void set_tokenizer(CTokenizer* tokenizer);
75 
80  void set_text(SGVector<char> text);
81 
83  virtual const char* get_name() const { return "Parser"; }
84 
85 private:
87  void init();
88 
89 private:
91  SGVector<char> m_text;
92 
94  CTokenizer* m_tokenizer;
95 };
96 
97 }
98 
99 #endif

SHOGUN Machine Learning Toolbox - Documentation