From 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Wed, 8 Aug 2018 17:00:41 -0700 Subject: Down-integrate from google3. --- src/google/protobuf/implicit_weak_message.h | 33 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/google/protobuf/implicit_weak_message.h') diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h index 3279bd17..29836289 100644 --- a/src/google/protobuf/implicit_weak_message.h +++ b/src/google/protobuf/implicit_weak_message.h @@ -31,10 +31,15 @@ #ifndef GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ #define GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ +#include #include #include #include +#ifdef SWIG +#error "You cannot SWIG proto headers" +#endif + // This file is logically internal-only and should only be used by protobuf // generated code. @@ -71,6 +76,13 @@ class LIBPROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite { bool MergePartialFromCodedStream(io::CodedInputStream* input); +#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER + ParseFunc _ParseFunc() const { return _InternalParse; } + + static const char* _InternalParse(const char* begin, const char* end, + void* object, ParseContext* ctx); +#endif + size_t ByteSizeLong() const { return data_.size(); } void SerializeWithCachedSizes(io::CodedOutputStream* output) const { @@ -92,7 +104,7 @@ template class ImplicitWeakTypeHandler { public: typedef ImplicitWeakType Type; - typedef ::google::protobuf::MessageLite WeakType; + typedef MessageLite WeakType; static const bool Moveable = false; // With implicit weak fields, we need separate NewFromPrototype and @@ -100,27 +112,24 @@ class ImplicitWeakTypeHandler { // strong dependency on the message type, and it just delegates to the // GenericTypeHandler. The latter avoids creating a strong dependency, by // simply calling MessageLite::New. - static inline ::google::protobuf::MessageLite* NewFromPrototype( - const ::google::protobuf::MessageLite* prototype, ::google::protobuf::Arena* arena = NULL) { + static inline MessageLite* NewFromPrototype(const MessageLite* prototype, + Arena* arena = NULL) { return prototype->New(arena); } - static inline void Delete(::google::protobuf::MessageLite* value, Arena* arena) { + static inline void Delete(MessageLite* value, Arena* arena) { if (arena == NULL) { delete value; } } - static inline ::google::protobuf::Arena* GetArena(::google::protobuf::MessageLite* value) { + static inline Arena* GetArena(MessageLite* value) { return value->GetArena(); } - static inline void* GetMaybeArenaPointer(::google::protobuf::MessageLite* value) { + static inline void* GetMaybeArenaPointer(MessageLite* value) { return value->GetArena(); } - static inline void Clear(::google::protobuf::MessageLite* value) { - value->Clear(); - } - static void Merge(const ::google::protobuf::MessageLite& from, - ::google::protobuf::MessageLite* to) { + static inline void Clear(MessageLite* value) { value->Clear(); } + static void Merge(const MessageLite& from, MessageLite* to) { to->CheckTypeAndMergeFrom(from); } static inline size_t SpaceUsedLong(const Type& value) { @@ -130,6 +139,6 @@ class ImplicitWeakTypeHandler { } // namespace internal } // namespace protobuf - } // namespace google + #endif // GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__ -- cgit v1.2.3