Add JsonObject::field_count.
This commit is contained in:
parent
59044294a8
commit
43941c1e69
@ -226,7 +226,7 @@ static tl_object_ptr<td_api::PaymentProvider> convert_payment_provider(
|
||||
LOG(ERROR) << "Unsupported JSON data \"" << native_parameters->data_ << '"';
|
||||
return nullptr;
|
||||
}
|
||||
if (value.get_object().field_values_.size() != 1) {
|
||||
if (value.get_object().field_count() != 1) {
|
||||
LOG(ERROR) << "Unsupported JSON data \"" << native_parameters->data_ << '"';
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ static tl_object_ptr<td_api::PaymentProvider> convert_payment_provider(
|
||||
LOG(ERROR) << "Unsupported JSON data \"" << native_parameters->data_ << '"';
|
||||
return nullptr;
|
||||
}
|
||||
if (value.get_object().field_values_.size() != 5) {
|
||||
if (value.get_object().field_count() != 5) {
|
||||
LOG(ERROR) << "Unsupported JSON data \"" << native_parameters->data_ << '"';
|
||||
}
|
||||
|
||||
|
@ -456,6 +456,10 @@ using JsonArray = vector<JsonValue>;
|
||||
class JsonObject {
|
||||
public:
|
||||
vector<std::pair<MutableSlice, JsonValue>> field_values_;
|
||||
|
||||
size_t field_count() const {
|
||||
return field_values_.size();
|
||||
}
|
||||
};
|
||||
|
||||
class JsonValue final : private Jsonable {
|
||||
|
Loading…
Reference in New Issue
Block a user