aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/util/internal/proto_writer.h
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xiaofeng@google.com>2016-07-01 15:43:37 -0700
committerGravatar GitHub <noreply@github.com>2016-07-01 15:43:37 -0700
commitcae3b0cbb689d0ed1e5da73942a5a9705f3411b0 (patch)
tree855f5c2c2d2dd82715145401ed68d20ff025693c /src/google/protobuf/util/internal/proto_writer.h
parent02b55d248f2fa9f24905201d1ba16a79dd20fdc8 (diff)
parent31999a3f95d8ec9f93b56b0966e2895c5205da53 (diff)
Merge pull request #1704 from lizan/json_parse_options
Add JsonParseOptions to ignore unknown fields
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 ffb8f60e..da121809 100644
--- a/src/google/protobuf/util/internal/proto_writer.h
+++ b/src/google/protobuf/util/internal/proto_writer.h
@@ -143,6 +143,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:
@@ -244,7 +248,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
@@ -297,6 +302,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.