aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/util/internal/proto_writer.h
diff options
context:
space:
mode:
authorGravatar Lizan Zhou <zlizan@google.com>2016-06-22 11:46:10 -0700
committerGravatar Lizan Zhou <zlizan@google.com>2016-06-28 00:17:06 -0700
commit31999a3f95d8ec9f93b56b0966e2895c5205da53 (patch)
treeb6b430749dd1af0444b1de5a90682bf26716341a /src/google/protobuf/util/internal/proto_writer.h
parentdc0aeaa9030bdac264b44d56d07b6839a1ae94e9 (diff)
Add JsonParseOptions to ignore unknown fields
- add JsonParseOptions for JsonToBinaryString allow unknown fields - rename current JsonOptions to JsonPrintOptions
Diffstat (limited to 'src/google/protobuf/util/internal/proto_writer.h')
-rw-r--r--src/google/protobuf/util/internal/proto_writer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/google/protobuf/util/internal/proto_writer.h b/src/google/protobuf/util/internal/proto_writer.h
index 957565e7..6f276065 100644
--- a/src/google/protobuf/util/internal/proto_writer.h
+++ b/src/google/protobuf/util/internal/proto_writer.h
@@ -142,6 +142,10 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
const TypeInfo* typeinfo() { return typeinfo_; }
+ void set_ignore_unknown_fields(bool ignore_unknown_fields) {
+ ignore_unknown_fields_ = ignore_unknown_fields;
+ }
+
protected:
class LIBPROTOBUF_EXPORT ProtoElement : public BaseElement, public LocationTrackerInterface {
public:
@@ -240,7 +244,8 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// Lookup the field in the current element. Looks in the base descriptor
// and in any extension. This will report an error if the field cannot be
- // found or if multiple matching extensions are found.
+ // found when ignore_unknown_names_ is false or if multiple matching
+ // extensions are found.
const google::protobuf::Field* Lookup(StringPiece name);
// Lookup the field type in the type descriptor. Returns NULL if the type
@@ -293,6 +298,9 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter {
// Indicates whether we finished writing root message completely.
bool done_;
+ // If true, don't report unknown field names to the listener.
+ bool ignore_unknown_fields_;
+
// Variable for internal state processing:
// element_ : the current element.
// size_insert_: sizes of nested messages.