Skip to content

Commit 71897c5

Browse files
committed
1. Rename function
2. put index for array type
1 parent 2a1c73d commit 71897c5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AllowAllArgumentsOnNextLine: 'false'
1212
AllowAllConstructorInitializersOnNextLine: 'true'
1313
AllowAllParametersOfDeclarationOnNextLine: 'false'
1414
AllowShortBlocksOnASingleLine: 'true'
15-
AllowShortCaseLabelsOnASingleLine: 'true'
15+
AllowShortCaseLabelsOnASingleLine: 'false'
1616
AllowShortFunctionsOnASingleLine: Empty
1717
AllowShortEnumsOnASingleLine: 'true'
1818
AllowShortIfStatementsOnASingleLine: Never

NppJSONViewer/NppJsonViewer/RapidJsonHandler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bool RapidJsonHandler::Null()
1212
return false;
1313

1414
TreeNode *parent = m_NodeStack.top();
15-
HandleArray(parent, STR_NULL, false);
15+
InsertToTree(parent, STR_NULL, false);
1616
return true;
1717
}
1818

@@ -22,7 +22,7 @@ bool RapidJsonHandler::Bool(bool b)
2222
return false;
2323

2424
TreeNode *parent = m_NodeStack.top();
25-
HandleArray(parent, b ? STR_TRUE : STR_FALSE, false);
25+
InsertToTree(parent, b ? STR_TRUE : STR_FALSE, false);
2626
return true;
2727
}
2828

@@ -57,7 +57,7 @@ bool RapidJsonHandler::RawNumber(const Ch *str, unsigned /*length*/, bool /*copy
5757
return false;
5858

5959
TreeNode *parent = m_NodeStack.top();
60-
HandleArray(parent, str, false);
60+
InsertToTree(parent, str, false);
6161
return true;
6262
}
6363

@@ -74,7 +74,7 @@ bool RapidJsonHandler::String(const Ch *str, unsigned /*length*/, bool /*copy*/)
7474
}
7575

7676
TreeNode *parent = m_NodeStack.top();
77-
HandleArray(parent, str, true);
77+
InsertToTree(parent, str, true);
7878

7979
return true;
8080
}
@@ -193,7 +193,7 @@ bool RapidJsonHandler::EndArray(unsigned /*elementCount*/)
193193
return true;
194194
}
195195

196-
void RapidJsonHandler::HandleArray(TreeNode *node, const char *const str, bool bQuote)
196+
void RapidJsonHandler::InsertToTree(TreeNode *node, const char *const str, bool bQuote)
197197
{
198198
if (!node || !str)
199199
return;
@@ -206,7 +206,7 @@ void RapidJsonHandler::HandleArray(TreeNode *node, const char *const str, bool b
206206
}
207207
else
208208
{
209-
node->node.key = std::to_string(node->counter);
209+
node->node.key = "[" + std::to_string(node->counter) + "]";
210210
node->node.value = str;
211211
node->counter++;
212212
}

NppJSONViewer/NppJsonViewer/RapidJsonHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ class RapidJsonHandler : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
4848
bool EndArray(unsigned elementCount);
4949

5050
private:
51-
void HandleArray(TreeNode *node, const char *const str, bool bQuote);
51+
void InsertToTree(TreeNode *node, const char *const str, bool bQuote);
5252
};

0 commit comments

Comments
 (0)