Skip to content

Commit b7b0a7b

Browse files
committed
rename to TreeBuilder
1 parent 54e732d commit b7b0a7b

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

NppJSONViewer/JSONDialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2222
#include "json.h"
2323
#include <sstream>
2424
#include "StopWatch.h"
25-
#include "SaxHandler.h"
25+
#include "TreeBuilder.h"
2626
#include "rapidjson/reader.h"
2727

2828
using win32::Stopwatch;
@@ -91,7 +91,7 @@ void JSONDialog::setJSON(char* json)
9191
void JSONDialog::populateTreeUsingSax(HWND hWndDlg, HTREEITEM tree_root, char *json) {
9292
Stopwatch sw;
9393
sw.Start();
94-
SaxHandler handler(this, tree_root);
94+
TreeBuilder handler(this, tree_root);
9595
rapidjson::Reader reader;
9696

9797
rapidjson::StringStream ss(json);

NppJSONViewer/NPPJSONViewer.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
<ClCompile Include="JSONDialog.cpp" />
176176
<ClCompile Include="NppPlugin.cpp" />
177177
<ClCompile Include="PluginDefinition.cpp" />
178-
<ClCompile Include="SaxHandler.cpp" />
178+
<ClCompile Include="TreeBuilder.cpp" />
179179
<ClCompile Include="StaticDialog.cpp" />
180180
</ItemGroup>
181181
<ItemGroup>
@@ -190,7 +190,7 @@
190190
<ClInclude Include="PluginDefinition.h" />
191191
<ClInclude Include="PluginInterface.h" />
192192
<ClInclude Include="resource.h" />
193-
<ClInclude Include="SaxHandler.h" />
193+
<ClInclude Include="TreeBuilder.h" />
194194
<ClInclude Include="Scintilla.h" />
195195
<ClInclude Include="StaticDialog.h" />
196196
<ClInclude Include="StopWatch.h" />

NppJSONViewer/NPPJSONViewer.vcxproj.filters

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<ClCompile Include="StaticDialog.cpp">
3434
<Filter>Source Files</Filter>
3535
</ClCompile>
36-
<ClCompile Include="SaxHandler.cpp">
36+
<ClCompile Include="TreeBuilder.cpp">
3737
<Filter>Source Files</Filter>
3838
</ClCompile>
3939
</ItemGroup>
@@ -83,10 +83,10 @@
8383
<ClInclude Include="StopWatch.h">
8484
<Filter>Header Files</Filter>
8585
</ClInclude>
86-
<ClInclude Include="SaxHandler.h">
86+
<ClInclude Include="utils.h">
8787
<Filter>Header Files</Filter>
8888
</ClInclude>
89-
<ClInclude Include="utils.h">
89+
<ClInclude Include="TreeBuilder.h">
9090
<Filter>Header Files</Filter>
9191
</ClInclude>
9292
</ItemGroup>
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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";
4141
const char* TRUE_STR = "true";
4242
const 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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ struct TreeNode {
1515
};
1616

1717

18-
class SaxHandler : public BaseReaderHandler<UTF8<>, SaxHandler>
18+
class TreeBuilder : public BaseReaderHandler<UTF8<>, TreeBuilder>
1919
{
2020
JSONDialog *dlg;
2121
std::stack<TreeNode*> stack;
2222
HTREEITEM treeRoot;
2323
char *lastKey;
2424
public:
25-
SaxHandler(JSONDialog *dlg, HTREEITEM treeRoot);
26-
~SaxHandler();
25+
TreeBuilder(JSONDialog *dlg, HTREEITEM treeRoot);
26+
~TreeBuilder();
2727

2828
bool Null();
2929
bool Bool(bool b);

0 commit comments

Comments
 (0)