diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2015-02-28 14:51:22 -0800 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2015-02-28 17:06:49 -0800 |
commit | 885b612f74f133678bf82808c589331e4c59dad9 (patch) | |
tree | e5f3f65b41af477c52810053b8694896c8bcd1f7 /src/google/protobuf/unknown_enum_impl.h | |
parent | 1939efed2db35020b7830a4927f10feac47b6757 (diff) | |
download | protobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.gz protobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.bz2 protobuf-885b612f74f133678bf82808c589331e4c59dad9.zip |
Down integrate from Google internal branch for C++ and Java.
- Maps for C++ lite
- C++ Arena optimizations.
- Java Lite runtime code size optimization.
Change-Id: I7537a4357c1cb385d23f9e8aa7ffdfeefe079f13
Diffstat (limited to 'src/google/protobuf/unknown_enum_impl.h')
-rw-r--r-- | src/google/protobuf/unknown_enum_impl.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/google/protobuf/unknown_enum_impl.h b/src/google/protobuf/unknown_enum_impl.h index fb5380aa..39c10cbc 100644 --- a/src/google/protobuf/unknown_enum_impl.h +++ b/src/google/protobuf/unknown_enum_impl.h @@ -99,6 +99,29 @@ bool GetRepeatedEnumUnknowns_Template( } // NOTE: You should not call these functions directly. Instead use +// CLEAR_UNKNOWN_ENUM(), defined in the public header. The macro-versions +// operate in a type-safe manner and behave appropriately for the proto +// version of the message, whereas these versions assume a specific proto +// version and allow the caller to pass in any arbitrary integer value as a +// field number. +// +// Clears the unknown entries of the given field of the message. +void ClearUnknownEnum(Message* message, int32 field_number); +// In proto1, clears the field if the value is out of range. +// TODO(karner): Delete this or make it proto2-only once the migration +// to proto2 is complete. +void ClearUnknownEnumProto1(Message* message, int32 field_number); +template <typename T> +void ClearUnknownEnum_Template(T* message, int32 field_number) { + if (internal::is_base_of<bridge::internal::Proto1CompatibleMessage, T>::value || + !internal::is_base_of<ProtocolMessage, T>::value) { + ClearUnknownEnum(message, field_number); + } else { + ClearUnknownEnumProto1(message, field_number); + } +} + +// NOTE: You should not call these functions directly. Instead use // SET_UNKNOWN_ENUM(), defined in the public header. The macro-versions // operate in a type-safe manner and behave appropriately for the proto // version of the message, whereas these versions assume a specific proto |