diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2015-10-05 11:59:43 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2015-10-05 11:59:43 -0700 |
commit | 46e8ff63cb67a6520711da5317aaaef04d0414d0 (patch) | |
tree | 64370726fe469f8dfca7b14f8b8cb80b6cc856f6 /src/google/protobuf/util/message_differencer.h | |
parent | 0087da9d4775f79c67362cc89c653f3a33a9bae2 (diff) |
Down-integrate from google internal.
Diffstat (limited to 'src/google/protobuf/util/message_differencer.h')
-rw-r--r-- | src/google/protobuf/util/message_differencer.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h index e002a0f3..34c173db 100644 --- a/src/google/protobuf/util/message_differencer.h +++ b/src/google/protobuf/util/message_differencer.h @@ -278,6 +278,13 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { const Message& message2, const vector<SpecificField>& field_path) { } + // Report that an unkown field is ignored. (see comment above). + // Note this is a different function since the last SpecificField in field + // path has a null field. This could break existing Reporter. + virtual void ReportUnknownFieldIgnored( + const Message& message1, const Message& message2, + const vector<SpecificField>& field_path) {} + private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Reporter); }; @@ -317,6 +324,16 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { const Message& message2, const FieldDescriptor* field, const vector<SpecificField>& parent_fields) = 0; + + // Returns true if the unknown field should be ignored. + // Note: This will be called for unknown fields as well in which case + // field.field will be null. + virtual bool IsUnknownFieldIgnored( + const Message& message1, const Message& message2, + const SpecificField& field, + const vector<SpecificField>& parent_fields) { + return false; + } }; // To add a Reporter, construct default here, then use ReportDifferencesTo or @@ -583,6 +600,10 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { const Message& message2, const vector<SpecificField>& field_path); + virtual void ReportUnknownFieldIgnored( + const Message& message1, const Message& message2, + const vector<SpecificField>& field_path); + protected: // Prints the specified path of fields to the buffer. virtual void PrintPath(const vector<SpecificField>& field_path, @@ -722,6 +743,12 @@ class LIBPROTOBUF_EXPORT MessageDifferencer { const FieldDescriptor* field, const vector<SpecificField>& parent_fields); + // Returns true if this unknown field is to be ignored when this + // MessageDifferencer compares messages. + bool IsUnknownFieldIgnored(const Message& message1, const Message& message2, + const SpecificField& field, + const vector<SpecificField>& parent_fields); + // Returns MapKeyComparator* when this field has been configured to // be treated as a map. If not, returns NULL. const MapKeyComparator* GetMapKeyComparator(const FieldDescriptor* field); |