Add get_json_object_field_force.
GitOrigin-RevId: f1e27a7dfb946396917ae347edd68259465f0d87
This commit is contained in:
parent
d919282894
commit
1df4a1c6a4
@ -593,6 +593,15 @@ bool has_json_object_field(const JsonObject &object, Slice name) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JsonValue get_json_object_field_force(JsonObject &object, Slice name) {
|
||||||
|
for (auto &field_value : object) {
|
||||||
|
if (field_value.first == name) {
|
||||||
|
return std::move(field_value.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return JsonValue();
|
||||||
|
}
|
||||||
|
|
||||||
Result<JsonValue> get_json_object_field(JsonObject &object, Slice name, JsonValue::Type type, bool is_optional) {
|
Result<JsonValue> get_json_object_field(JsonObject &object, Slice name, JsonValue::Type type, bool is_optional) {
|
||||||
for (auto &field_value : object) {
|
for (auto &field_value : object) {
|
||||||
if (field_value.first == name) {
|
if (field_value.first == name) {
|
||||||
|
@ -860,6 +860,8 @@ auto json_array(const A &a, F &&f) {
|
|||||||
|
|
||||||
bool has_json_object_field(const JsonObject &object, Slice name);
|
bool has_json_object_field(const JsonObject &object, Slice name);
|
||||||
|
|
||||||
|
JsonValue get_json_object_field_force(JsonObject &object, Slice name) TD_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
Result<JsonValue> get_json_object_field(JsonObject &object, Slice name, JsonValue::Type type,
|
Result<JsonValue> get_json_object_field(JsonObject &object, Slice name, JsonValue::Type type,
|
||||||
bool is_optional = true) TD_WARN_UNUSED_RESULT;
|
bool is_optional = true) TD_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user