Implement Value::demand()

This commit is contained in:
Frank Richter
2019-03-23 14:31:06 +01:00
parent eb7bd9546e
commit d76fe5687d
3 changed files with 16 additions and 1 deletions

View File

@@ -1126,6 +1126,12 @@ Value const* Value::find(char const* begin, char const* end) const {
return nullptr;
return &(*it).second;
}
Value* Value::demand(char const* begin, char const* end) {
JSON_ASSERT_MESSAGE(type() == nullValue || type() == objectValue,
"in Json::Value::demand(begin, end): requires "
"objectValue or nullValue");
return &resolveReference(begin, end);
}
const Value& Value::operator[](const char* key) const {
Value const* found = find(key, key + strlen(key));
if (!found)