| Index: third_party/protobuf/src/google/protobuf/message.cc
|
| ===================================================================
|
| --- third_party/protobuf/src/google/protobuf/message.cc (revision 216642)
|
| +++ third_party/protobuf/src/google/protobuf/message.cc (working copy)
|
| @@ -44,11 +44,12 @@
|
| #include <google/protobuf/io/zero_copy_stream_impl.h>
|
| #include <google/protobuf/descriptor.pb.h>
|
| #include <google/protobuf/descriptor.h>
|
| +#include <google/protobuf/generated_message_util.h>
|
| #include <google/protobuf/reflection_ops.h>
|
| #include <google/protobuf/wire_format.h>
|
| #include <google/protobuf/stubs/strutil.h>
|
| #include <google/protobuf/stubs/map-util.h>
|
| -#include <google/protobuf/stubs/stl_util-inl.h>
|
| +#include <google/protobuf/stubs/stl_util.h>
|
|
|
| namespace google {
|
| namespace protobuf {
|
| @@ -182,9 +183,46 @@
|
| }
|
|
|
|
|
| +// =============================================================================
|
| +// Reflection and associated Template Specializations
|
| +
|
| Reflection::~Reflection() {}
|
|
|
| -// ===================================================================
|
| +#define HANDLE_TYPE(TYPE, CPPTYPE, CTYPE) \
|
| +template<> \
|
| +const RepeatedField<TYPE>& Reflection::GetRepeatedField<TYPE>( \
|
| + const Message& message, const FieldDescriptor* field) const { \
|
| + return *static_cast<RepeatedField<TYPE>* >( \
|
| + MutableRawRepeatedField(const_cast<Message*>(&message), \
|
| + field, CPPTYPE, CTYPE, NULL)); \
|
| +} \
|
| + \
|
| +template<> \
|
| +RepeatedField<TYPE>* Reflection::MutableRepeatedField<TYPE>( \
|
| + Message* message, const FieldDescriptor* field) const { \
|
| + return static_cast<RepeatedField<TYPE>* >( \
|
| + MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, NULL)); \
|
| +}
|
| +
|
| +HANDLE_TYPE(int32, FieldDescriptor::CPPTYPE_INT32, -1);
|
| +HANDLE_TYPE(int64, FieldDescriptor::CPPTYPE_INT64, -1);
|
| +HANDLE_TYPE(uint32, FieldDescriptor::CPPTYPE_UINT32, -1);
|
| +HANDLE_TYPE(uint64, FieldDescriptor::CPPTYPE_UINT64, -1);
|
| +HANDLE_TYPE(float, FieldDescriptor::CPPTYPE_FLOAT, -1);
|
| +HANDLE_TYPE(double, FieldDescriptor::CPPTYPE_DOUBLE, -1);
|
| +HANDLE_TYPE(bool, FieldDescriptor::CPPTYPE_BOOL, -1);
|
| +
|
| +
|
| +#undef HANDLE_TYPE
|
| +
|
| +void* Reflection::MutableRawRepeatedString(
|
| + Message* message, const FieldDescriptor* field, bool is_string) const {
|
| + return MutableRawRepeatedField(message, field,
|
| + FieldDescriptor::CPPTYPE_STRING, FieldOptions::STRING, NULL);
|
| +}
|
| +
|
| +
|
| +// =============================================================================
|
| // MessageFactory
|
|
|
| MessageFactory::~MessageFactory() {}
|
| @@ -258,6 +296,7 @@
|
| }
|
| }
|
|
|
| +
|
| const Message* GeneratedMessageFactory::GetPrototype(const Descriptor* type) {
|
| {
|
| ReaderMutexLock lock(&mutex_);
|
|
|