ulib  1.0
S.W. Lee's essential C++ library
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
ujson.h
Go to the documentation of this file.
1 /*
2  작성자 : swlee
3  작성일 : Apr. 4, 2013
4  버전 : 0.1.0
5  설명 :
6  미구현 :
7  버그 :
8 */
9 
10 #ifndef ___ujson___
11 #define ___ujson___
12 
13 #include <stdio.h>
14 #include <string.h>
15 #include <time.h>
16 #include "uparser.h"
17 #include "ustring.h"
18 
19 
20 namespace ulib {
21 
22  class CUJsonContainer;
23  class CUJsonItem{
24  public:
25 
29 
31  value2 = NULL;
32  }
33  };
34  typedef map<string, CUJsonItem> item_map_t;
36  public:
39  };
40 
41 
42  class CUJsonToken {
43  public:
46  int match_idx;
47  bool consumed;
48 
50  {
51  match_idx=-1;
52  consumed = false;
53  }
54  };
55 
56 
58  class CUJsonTokenList : public CUList {
59  public:
60  void PushBack( CUString str );
61  CUJsonToken *GetAt( int i );
62  void Print();
63  };
64 
65 
67  class CUJson: public CUParser {
68  public:
69  CUJson();
70  ~CUJson();
71  public:
72 
73  virtual bool Load( CUString &str );
74  virtual bool ToString( CUString &ret );
75 
76  bool Tokenize();
77  bool MatchBrace( int start_idx, int end_idx );
78  bool Parse( int start_idx, int end_idx );
79 
80  public:
84 
85  private:
86  void Preproc();
87  int FindMatchBraceIdx( int start_idx, int end_idx, int pos );
88  int FindMatchCurlBraceIdx( int start_idx, int end_idx, int pos );
89 
90  private:
91 
92 
93  };
94 
95 }
96 
97 #endif
98 
99 // EOF ㅁ
100