| 262 | } |
| 263 | |
| 264 | static nlohmann::json* FindJSON(nlohmann::json& md5JSON, const std::string& key, |
| 265 | std::string* lastKey) { |
| 266 | std::vector<std::string> keys = {}; |
| 267 | size_t start; |
| 268 | size_t end = 0; |
| 269 | while ((start = key.find_first_not_of('/', end)) != std::string::npos) { |
| 270 | end = key.find('/', start); |
| 271 | keys.push_back(key.substr(start, end - start)); |
| 272 | } |
| 273 | *lastKey = keys.back(); |
| 274 | keys.pop_back(); |
| 275 | auto json = &md5JSON; |
| 276 | for (auto& jsonKey : keys) { |
| 277 | if ((*json)[jsonKey] == nullptr) { |
| 278 | (*json)[jsonKey] = {}; |
| 279 | } |
| 280 | json = &(*json)[jsonKey]; |
| 281 | } |
| 282 | return json; |
| 283 | } |
| 284 | |
| 285 | std::string Baseline::getJSONValue(nlohmann::json& target, const std::string& key) { |
| 286 | std::lock_guard<std::mutex> autoLock(locker); |
no test coverage detected