aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/message_lite.h
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@google.com>2017-12-01 10:05:10 -0800
committerGravatar Adam Cozzette <acozzette@google.com>2017-12-01 10:05:10 -0800
commit92a7e778e7394386f413cec28d67a07630f784b1 (patch)
treecb5673c7c09b0d3905b48a24765d07e423bc5b30 /src/google/protobuf/message_lite.h
parentce0a53273a400369932ba788d17500336a6ecaad (diff)
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/message_lite.h')
-rw-r--r--src/google/protobuf/message_lite.h19
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; }