diff options
author | Adam Cozzette <acozzette@google.com> | 2017-12-01 10:05:10 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2017-12-01 10:05:10 -0800 |
commit | 92a7e778e7394386f413cec28d67a07630f784b1 (patch) | |
tree | cb5673c7c09b0d3905b48a24765d07e423bc5b30 /src/google/protobuf/message_lite.h | |
parent | ce0a53273a400369932ba788d17500336a6ecaad (diff) |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/message_lite.h')
-rw-r--r-- | src/google/protobuf/message_lite.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 5cd6babc..0b2b24b2 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -48,6 +48,8 @@ namespace google { namespace protobuf { class Arena; +template <typename T> +class RepeatedPtrField; namespace io { class CodedInputStream; class CodedOutputStream; @@ -56,6 +58,7 @@ class ZeroCopyOutputStream; } namespace internal { +class RepeatedPtrFieldBase; class WireFormatLite; #ifndef SWIG @@ -380,6 +383,22 @@ class LIBPROTOBUF_EXPORT MessageLite { virtual uint8* InternalSerializeWithCachedSizesToArray(bool deterministic, uint8* target) const; + protected: + // CastToBase allows generated code to cast a RepeatedPtrField<T> to + // RepeatedPtrFieldBase. We try to restrict access to RepeatedPtrFieldBase + // because it is an implementation detail that user code should not access + // directly. + template <typename T> + static ::google::protobuf::internal::RepeatedPtrFieldBase* CastToBase( + ::google::protobuf::RepeatedPtrField<T>* repeated) { + return repeated; + } + template <typename T> + static const ::google::protobuf::internal::RepeatedPtrFieldBase& CastToBase( + const ::google::protobuf::RepeatedPtrField<T>& repeated) { + return repeated; + } + private: // TODO(gerbens) make this a pure abstract function virtual const void* InternalGetTable() const { return NULL; } |