| 194 | |
| 195 | private: |
| 196 | void AddEntry(const std::string& key, const std::string& value) { |
| 197 | Node* node = &root; |
| 198 | for (const char* pstr = key.c_str(); *pstr != '\0';) { |
| 199 | const size_t remainingLength = key.c_str() + key.length() - pstr; |
| 200 | const size_t charLength = Utf8CharLength(pstr, remainingLength); |
| 201 | if (charLength == 0) { |
| 202 | break; |
| 203 | } |
| 204 | std::unique_ptr<Node>& child = |
| 205 | node->children[Utf8CharKey(pstr, charLength)]; |
| 206 | if (child == nullptr) { |
| 207 | child.reset(new Node); |
| 208 | } |
| 209 | node = child.get(); |
| 210 | pstr += charLength; |
| 211 | } |
| 212 | if (!node->candidate.hasValue) { |
| 213 | node->candidate.hasValue = true; |
| 214 | node->candidate.keyLength = key.length(); |
| 215 | node->candidate.key = key; |
| 216 | node->candidate.value = value; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | Node root; |
| 221 | }; |
nothing calls this directly
no test coverage detected