diff options
author | Adam Cozzette <acozzette@google.com> | 2017-09-12 10:32:01 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2017-09-14 10:03:57 -0700 |
commit | 13fd045dbb2b4dacea32be162a41d5a4b0d1802f (patch) | |
tree | c219e7eb18b82523e36c6748861c403a14ea66ae /src/google/protobuf/map_entry.h | |
parent | d1bc27caef8377a710370189675cb0958443e8f1 (diff) | |
download | protobuf-13fd045dbb2b4dacea32be162a41d5a4b0d1802f.tar.gz protobuf-13fd045dbb2b4dacea32be162a41d5a4b0d1802f.tar.bz2 protobuf-13fd045dbb2b4dacea32be162a41d5a4b0d1802f.zip |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/map_entry.h')
-rw-r--r-- | src/google/protobuf/map_entry.h | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/src/google/protobuf/map_entry.h b/src/google/protobuf/map_entry.h index afe809b2..801def97 100644 --- a/src/google/protobuf/map_entry.h +++ b/src/google/protobuf/map_entry.h @@ -87,29 +87,6 @@ class MapEntry : public MapEntryImpl<Derived, Message, Key, Value, kKeyFieldType, kValueFieldType, default_enum_value> { public: - // Create default MapEntry instance for given descriptor. Descriptor has to be - // given when creating default MapEntry instance because different map field - // may have the same type and MapEntry class. The given descriptor is needed - // to distinguish instances of the same MapEntry class. - static const Reflection* CreateReflection(const Descriptor* descriptor, - const Derived* entry) { - ReflectionSchema schema = { - entry, - offsets_, - has_bits_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _internal_metadata_), - -1, - -1, - sizeof(MapEntry), - -1, - }; - const Reflection* reflection = new GeneratedMessageReflection( - descriptor, schema, DescriptorPool::generated_pool(), - MessageFactory::generated_factory()); - return reflection; - } - MapEntry() : _internal_metadata_(NULL) {} explicit MapEntry(Arena* arena) : MapEntryImpl<Derived, Message, Key, Value, kKeyFieldType, @@ -118,11 +95,9 @@ class MapEntry typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - private: - static uint32 offsets_[2]; - static uint32 has_bits_[2]; InternalMetadataWithArena _internal_metadata_; + private: friend class ::google::protobuf::Arena; template <typename C, typename K, typename V, WireFormatLite::FieldType k_wire_type, WireFormatLite::FieldType, @@ -133,32 +108,18 @@ class MapEntry GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapEntry); }; -template <typename Derived, typename Key, typename Value, - WireFormatLite::FieldType kKeyFieldType, - WireFormatLite::FieldType kValueFieldType, int default_enum_value> -uint32 MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value>::offsets_[2] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, key_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, value_), -}; - -template <typename Derived, typename Key, typename Value, - WireFormatLite::FieldType kKeyFieldType, - WireFormatLite::FieldType kValueFieldType, int default_enum_value> -uint32 MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value>::has_bits_[2] = {0, 1}; - // Specialization for the full runtime template <typename Derived, typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType, WireFormatLite::FieldType kValueFieldType, int default_enum_value> struct MapEntryHelper<MapEntry<Derived, Key, Value, kKeyFieldType, kValueFieldType, default_enum_value> > - : MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value> > { + : MapEntryHelper<MapEntryLite<Derived, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> > { explicit MapEntryHelper(const MapPair<Key, Value>& map_pair) - : MapEntryHelper<MapEntryLite<Key, Value, kKeyFieldType, kValueFieldType, - default_enum_value> >(map_pair) {} + : MapEntryHelper<MapEntryLite<Derived, Key, Value, kKeyFieldType, + kValueFieldType, default_enum_value> >( + map_pair) {} }; template <typename Derived, typename K, typename V, |