| 185 | } |
| 186 | |
| 187 | void RapidJsonHandler::InsertToTree(TreeNode* node, const char* const str, bool bQuote) |
| 188 | { |
| 189 | if (!node || !str) |
| 190 | return; |
| 191 | |
| 192 | if (node->node.type != JsonNodeType::ARRAY) |
| 193 | { |
| 194 | node->node.key = m_jsonLastKey; |
| 195 | node->node.value = str; |
| 196 | m_jsonLastKey.clear(); |
| 197 | } |
| 198 | else |
| 199 | { |
| 200 | node->node.key.strKey = "[" + std::to_string(node->counter) + "]"; |
| 201 | node->node.value = str; |
| 202 | |
| 203 | size_t valueLen = node->node.value.size(); |
| 204 | node->node.key.pos.nLine = m_pTS->getLine(); |
| 205 | node->node.key.pos.nColumn = m_pTS->getColumn() - valueLen - (bQuote ? 1 : 0); // -1 to deal with double quote in string |
| 206 | node->node.key.pos.nKeyLength = valueLen; |
| 207 | |
| 208 | node->counter++; |
| 209 | } |
| 210 | |
| 211 | // Insert item to tree |
| 212 | if (bQuote) |
| 213 | m_pTreeHandler->InsertToTree(node->subRoot, node->node.key.strKey + " : \"" + node->node.value + "\"", node->node.key.pos); |
| 214 | else |
| 215 | m_pTreeHandler->InsertToTree(node->subRoot, node->node.key.strKey + " : " + node->node.value, node->node.key.pos); |
| 216 | } |
| 217 | |
| 218 | void RapidJsonHandler::AppendNodeCount(unsigned elementCount, bool bArray) |
| 219 | { |
no test coverage detected