From 47ab39aee6330f59263b0a9b2fc36536544651fd Mon Sep 17 00:00:00 2001 From: rsgowman Date: Mon, 25 Jun 2018 10:06:35 -0400 Subject: Refactor nanopb decoding methods (#1438) Rather than decoding the type, and then the contents, decode them both at once. --- Firestore/core/src/firebase/firestore/nanopb/reader.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Firestore/core/src/firebase/firestore/nanopb/reader.h') diff --git a/Firestore/core/src/firebase/firestore/nanopb/reader.h b/Firestore/core/src/firebase/firestore/nanopb/reader.h index 7dd7432..76dc3b6 100644 --- a/Firestore/core/src/firebase/firestore/nanopb/reader.h +++ b/Firestore/core/src/firebase/firestore/nanopb/reader.h @@ -57,6 +57,16 @@ class Reader { */ Tag ReadTag(); + /** + * Ensures the specified tag is of the specified type. If not, then + * Reader::status() will return a non-ok value (with the code set to + * FirestoreErrorCode::DataLoss). + * + * @return Convenience indicator for success. (If false, then status() will + * return a non-ok value.) + */ + bool RequireWireType(pb_wire_type_t wire_type, Tag tag); + /** * Reads a nanopb message from the input stream. * -- cgit v1.2.3