| 284 | } |
| 285 | |
| 286 | void removeValueFromArray(List<JsonElement>& elements, size_t loc) { |
| 287 | // Remove the value itself, the comma following and the whitespace up to the |
| 288 | // next value. |
| 289 | // If it's the last value, it removes the value, and the preceding whitespace |
| 290 | // and comma. |
| 291 | size_t commaLoc = elements.indexOf(CommaElement{}, loc); |
| 292 | if (commaLoc != NPos) { |
| 293 | elements.eraseAt(loc, commaLoc + 1); |
| 294 | while (loc < elements.size() && elements.at(loc).is<WhitespaceElement>()) |
| 295 | elements.eraseAt(loc); |
| 296 | } else { |
| 297 | commaLoc = elements.lastIndexOf(CommaElement{}, loc); |
| 298 | if (commaLoc == NPos) |
| 299 | commaLoc = 0; |
| 300 | elements.eraseAt(commaLoc, loc + 1); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | FormattedJson FormattedJson::eraseKey(String const& key) const { |
| 305 | if (type() != Json::Type::Object) |
no test coverage detected