diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2018-08-08 17:00:41 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2018-08-08 17:00:41 -0700 |
commit | 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 (patch) | |
tree | e575738adf52d24b883cca5e8928a5ded31caba1 /src/google/protobuf/map_type_handler.h | |
parent | e7746f487cb9cca685ffb1b3d7dccc5554b618a4 (diff) | |
download | protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.gz protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.bz2 protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.zip |
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/map_type_handler.h')
-rw-r--r-- | src/google/protobuf/map_type_handler.h | 175 |
1 files changed, 88 insertions, 87 deletions
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index 7f7b1e0e..0489851e 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -34,6 +34,10 @@ #include <google/protobuf/arena.h> #include <google/protobuf/wire_format_lite_inl.h> +#ifdef SWIG +#error "You cannot SWIG proto headers" +#endif + namespace google { namespace protobuf { namespace internal { @@ -548,92 +552,89 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, // Definition for string/bytes handler -#define STRING_OR_BYTES_HANDLER_FUNCTIONS(FieldType) \ - template <typename Type> \ - inline const typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::MapEntryAccessorType& \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::GetExternalReference(const TypeOnMemory& value) { \ - return value.Get(); \ - } \ - template <typename Type> \ - inline size_t \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::SpaceUsedInMapEntryLong(const TypeOnMemory& value) { \ - return sizeof(value); \ - } \ - template <typename Type> \ - inline size_t \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \ - const TypeOnMemory& value) { \ - return sizeof(value); \ - } \ - template <typename Type> \ - inline size_t \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \ - const string& value) { \ - return sizeof(value); \ - } \ - template <typename Type> \ - inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \ - TypeOnMemory* value, Arena* arena) { \ - value->ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), \ - arena); \ - } \ - template <typename Type> \ - inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ - ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \ - int /* default_enum */) { \ - Clear(value, arena); \ - } \ - template <typename Type> \ - inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \ - const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \ - to->Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from, arena); \ - } \ - template <typename Type> \ - void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::DeleteNoArena( \ - TypeOnMemory& value) { \ - value.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ - } \ - template <typename Type> \ - inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::AssignDefaultValue(TypeOnMemory* /* value */) {} \ - template <typename Type> \ - inline void \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \ - TypeOnMemory* value, Arena* /* arena */) { \ - value->UnsafeSetDefault( \ - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ - } \ - template <typename Type> \ - inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ - InitializeMaybeByDefaultEnum(TypeOnMemory* value, \ - int /* default_enum_value */, \ - Arena* arena) { \ - Initialize(value, arena); \ - } \ - template <typename Type> \ - inline typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::MapEntryAccessorType* \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \ - TypeOnMemory* value, Arena* arena) { \ - return value->Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), \ - arena); \ - } \ - template <typename Type> \ - inline const typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::MapEntryAccessorType& \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \ - const TypeOnMemory& \ - /* default_value */) { \ - return value.Get(); \ - } \ - template <typename Type> \ - inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ - Type>::IsInitialized(const TypeOnMemory& /* value */) { \ - return true; \ +#define STRING_OR_BYTES_HANDLER_FUNCTIONS(FieldType) \ + template <typename Type> \ + inline const typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ + Type>::MapEntryAccessorType& \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ + Type>::GetExternalReference(const TypeOnMemory& value) { \ + return value.Get(); \ + } \ + template <typename Type> \ + inline size_t \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ + Type>::SpaceUsedInMapEntryLong(const TypeOnMemory& value) { \ + return sizeof(value); \ + } \ + template <typename Type> \ + inline size_t \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \ + const TypeOnMemory& value) { \ + return sizeof(value); \ + } \ + template <typename Type> \ + inline size_t \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \ + const string& value) { \ + return sizeof(value); \ + } \ + template <typename Type> \ + inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \ + TypeOnMemory* value, Arena* arena) { \ + value->ClearToEmpty(&internal::GetEmptyStringAlreadyInited(), arena); \ + } \ + template <typename Type> \ + inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ + ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \ + int /* default_enum */) { \ + Clear(value, arena); \ + } \ + template <typename Type> \ + inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \ + const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \ + to->Set(&internal::GetEmptyStringAlreadyInited(), from, arena); \ + } \ + template <typename Type> \ + void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::DeleteNoArena( \ + TypeOnMemory& value) { \ + value.DestroyNoArena(&internal::GetEmptyStringAlreadyInited()); \ + } \ + template <typename Type> \ + inline void \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::AssignDefaultValue( \ + TypeOnMemory* /* value */) {} \ + template <typename Type> \ + inline void \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \ + TypeOnMemory* value, Arena* /* arena */) { \ + value->UnsafeSetDefault(&internal::GetEmptyStringAlreadyInited()); \ + } \ + template <typename Type> \ + inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ + InitializeMaybeByDefaultEnum( \ + TypeOnMemory* value, int /* default_enum_value */, Arena* arena) { \ + Initialize(value, arena); \ + } \ + template <typename Type> \ + inline typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ + Type>::MapEntryAccessorType* \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \ + TypeOnMemory* value, Arena* arena) { \ + return value->Mutable(&internal::GetEmptyStringAlreadyInited(), arena); \ + } \ + template <typename Type> \ + inline const typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ + Type>::MapEntryAccessorType& \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ + DefaultIfNotInitialized(const TypeOnMemory& value, \ + const TypeOnMemory& /* default_value */) { \ + return value.Get(); \ + } \ + template <typename Type> \ + inline bool \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::IsInitialized( \ + const TypeOnMemory& /* value */) { \ + return true; \ } STRING_OR_BYTES_HANDLER_FUNCTIONS(STRING) STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES) @@ -734,6 +735,6 @@ PRIMITIVE_HANDLER_FUNCTIONS(BOOL) } // namespace internal } // namespace protobuf - } // namespace google + #endif // GOOGLE_PROTOBUF_TYPE_HANDLER_H__ |