Skip to content

Commit

Permalink
Add FieldValue.boolean_value() (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsgowman committed Feb 27, 2018
1 parent 3e7c062 commit 1ecf690
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Firestore/core/src/firebase/firestore/model/field_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ class FieldValue {
return tag_;
}

bool boolean_value() const {
FIREBASE_ASSERT(tag_ == Type::Boolean);
return boolean_value_;
}

int64_t integer_value() const {
FIREBASE_ASSERT(tag_ == Type::Integer);
return integer_value_;
Expand Down
7 changes: 1 addition & 6 deletions Firestore/core/src/firebase/firestore/remote/serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ void Serializer::EncodeFieldValue(const FieldValue& field_value,
// TODO(rsgowman): figure out error handling
abort();
}
if (field_value == FieldValue::TrueValue()) {
EncodeBool(&stream, true);
} else {
FIREBASE_DEV_ASSERT(field_value == FieldValue::FalseValue());
EncodeBool(&stream, false);
}
EncodeBool(&stream, field_value.boolean_value());
break;

case FieldValue::Type::Integer:
Expand Down

0 comments on commit 1ecf690

Please sign in to comment.