1- #include " SaxHandler .h"
1+ #include " TreeBuilder .h"
22#include < iostream>
33#include " JSONDialog.h"
44#include " utils.h"
@@ -41,27 +41,27 @@ const char* NULL_STR = "null";
4141const char * TRUE_STR = " true" ;
4242const char * FALSE_STR = " false" ;
4343
44- bool SaxHandler ::Null () {
44+ bool TreeBuilder ::Null () {
4545 return this ->String (NULL_STR, sizeof (NULL_STR), true );
4646}
4747
48- bool SaxHandler ::Bool (bool b) {
48+ bool TreeBuilder ::Bool (bool b) {
4949 if (b)
5050 return this ->String (TRUE_STR, sizeof (TRUE_STR), true );
5151 return this ->String (FALSE_STR, sizeof (FALSE_STR), true );
5252}
5353
54- bool SaxHandler ::Int (int i) { cout << " Int(" << i << " )" << endl; return true ; }
55- bool SaxHandler ::Uint (unsigned u) { cout << " Uint(" << u << " )" << endl; return true ; }
56- bool SaxHandler ::Int64 (int64_t i) { cout << " Int64(" << i << " )" << endl; return true ; }
57- bool SaxHandler ::Uint64 (uint64_t u) { cout << " Uint64(" << u << " )" << endl; return true ; }
58- bool SaxHandler ::Double (double d) { cout << " Double(" << d << " )" << endl; return true ; }
54+ bool TreeBuilder ::Int (int i) { cout << " Int(" << i << " )" << endl; return true ; }
55+ bool TreeBuilder ::Uint (unsigned u) { cout << " Uint(" << u << " )" << endl; return true ; }
56+ bool TreeBuilder ::Int64 (int64_t i) { cout << " Int64(" << i << " )" << endl; return true ; }
57+ bool TreeBuilder ::Uint64 (uint64_t u) { cout << " Uint64(" << u << " )" << endl; return true ; }
58+ bool TreeBuilder ::Double (double d) { cout << " Double(" << d << " )" << endl; return true ; }
5959
60- bool SaxHandler ::RawNumber (const char *str, SizeType length, bool copy) {
60+ bool TreeBuilder ::RawNumber (const char *str, SizeType length, bool copy) {
6161 return this ->String (str, length, copy);
6262}
6363
64- bool SaxHandler ::String (const char * str, SizeType length, bool copy) {
64+ bool TreeBuilder ::String (const char * str, SizeType length, bool copy) {
6565 // copy and process
6666 TreeNode *parent = this ->stack .top ();
6767 char *value = NULL ;
@@ -91,7 +91,7 @@ bool SaxHandler::String(const char* str, SizeType length, bool copy) {
9191 return true ;
9292}
9393
94- bool SaxHandler ::StartObject () {
94+ bool TreeBuilder ::StartObject () {
9595 TreeNode *parent;
9696 if (this ->stack .empty ()) {
9797 parent = new TreeNode;
@@ -125,7 +125,7 @@ bool SaxHandler::StartObject() {
125125 return true ;
126126}
127127
128- bool SaxHandler ::EndObject (SizeType memberCount) {
128+ bool TreeBuilder ::EndObject (SizeType memberCount) {
129129 if (!this ->stack .empty ()) {
130130 TreeNode *node = this ->stack .top ();
131131 this ->stack .pop ();
@@ -134,14 +134,14 @@ bool SaxHandler::EndObject(SizeType memberCount) {
134134 return true ;
135135}
136136
137- bool SaxHandler ::Key (const char * str, SizeType length, bool copy) {
137+ bool TreeBuilder ::Key (const char * str, SizeType length, bool copy) {
138138 this ->lastKey = new char [length + 1 ];
139139 strncpy (this ->lastKey , str, length);
140140 this ->lastKey [length] = ' \0 ' ;
141141 return true ;
142142}
143143
144- bool SaxHandler ::StartArray () {
144+ bool TreeBuilder ::StartArray () {
145145 TreeNode *parent;
146146 if (this ->stack .empty ()) {
147147 parent = new TreeNode;
@@ -174,7 +174,7 @@ bool SaxHandler::StartArray() {
174174 return true ;
175175}
176176
177- bool SaxHandler ::EndArray (SizeType elementCount) {
177+ bool TreeBuilder ::EndArray (SizeType elementCount) {
178178 if (!this ->stack .empty ()) {
179179 TreeNode *node = this ->stack .top ();
180180 this ->stack .pop ();
@@ -183,14 +183,14 @@ bool SaxHandler::EndArray(SizeType elementCount) {
183183 return true ;
184184}
185185
186- SaxHandler::SaxHandler (JSONDialog *dlg, HTREEITEM treeRoot) {
186+ TreeBuilder::TreeBuilder (JSONDialog *dlg, HTREEITEM treeRoot) {
187187 this ->dlg = dlg;
188188 this ->lastKey = NULL ;
189189 this ->treeRoot = treeRoot;
190190}
191191
192192
193- SaxHandler ::~SaxHandler ()
193+ TreeBuilder ::~TreeBuilder ()
194194{
195195}
196196
0 commit comments