diff options
author | rsgowman <rgowman@google.com> | 2018-03-08 11:53:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 11:53:37 -0500 |
commit | 2ae36f1e9671b40723dd06462b4a416e4baa5a57 (patch) | |
tree | 0a00567da114b546d4943f9cb180797b976e18a2 /Firestore/core/src/firebase/firestore/model/field_value.h | |
parent | b7750b588c1d7ae9ea3891a254a39de5d3b3c572 (diff) |
[De]Serialize FieldValue map_values ("Objects") (#878)
These can (recursively) contain other FieldValues.
Diffstat (limited to 'Firestore/core/src/firebase/firestore/model/field_value.h')
-rw-r--r-- | Firestore/core/src/firebase/firestore/model/field_value.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/field_value.h b/Firestore/core/src/firebase/firestore/model/field_value.h index cb219f5..fc8619d 100644 --- a/Firestore/core/src/firebase/firestore/model/field_value.h +++ b/Firestore/core/src/firebase/firestore/model/field_value.h @@ -111,6 +111,11 @@ class FieldValue { return string_value_; } + const std::map<std::string, FieldValue>& object_value() const { + FIREBASE_ASSERT(tag_ == Type::Object); + return object_value_; + } + /** factory methods. */ static const FieldValue& NullValue(); static const FieldValue& TrueValue(); @@ -134,10 +139,8 @@ class FieldValue { static FieldValue GeoPointValue(const GeoPoint& value); static FieldValue ArrayValue(const std::vector<FieldValue>& value); static FieldValue ArrayValue(std::vector<FieldValue>&& value); - static FieldValue ObjectValue( - const std::map<const std::string, const FieldValue>& value); - static FieldValue ObjectValue( - std::map<const std::string, const FieldValue>&& value); + static FieldValue ObjectValue(const std::map<std::string, FieldValue>& value); + static FieldValue ObjectValue(std::map<std::string, FieldValue>&& value); friend bool operator<(const FieldValue& lhs, const FieldValue& rhs); @@ -164,7 +167,7 @@ class FieldValue { firebase::firestore::model::ReferenceValue reference_value_; GeoPoint geo_point_value_; std::vector<FieldValue> array_value_; - std::map<const std::string, const FieldValue> object_value_; + std::map<std::string, FieldValue> object_value_; }; }; |