File indexing completed on 2026-09-08 09:12:11
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_MAP_ENTRY_H__
0009 #define GOOGLE_PROTOBUF_MAP_ENTRY_H__
0010
0011 #include <cstddef>
0012 #include <cstdint>
0013 #include <string>
0014 #include <type_traits>
0015
0016 #include "google/protobuf/generated_message_reflection.h"
0017 #include "google/protobuf/has_bits.h"
0018 #include "google/protobuf/map_type_handler.h"
0019 #include "google/protobuf/message.h"
0020 #include "google/protobuf/message_lite.h"
0021 #include "google/protobuf/parse_context.h"
0022 #include "google/protobuf/unknown_field_set.h"
0023 #include "google/protobuf/wire_format_lite.h"
0024
0025
0026 #include "google/protobuf/port_def.inc"
0027
0028 #ifdef SWIG
0029 #error "You cannot SWIG proto headers"
0030 #endif
0031
0032 namespace google {
0033 namespace protobuf {
0034
0035 class Arena;
0036
0037 namespace internal {
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType,
0066 WireFormatLite::FieldType kValueFieldType>
0067 class MapEntry : public Message {
0068
0069
0070 using KeyTypeHandler = MapTypeHandler<kKeyFieldType, Key>;
0071 using ValueTypeHandler = MapTypeHandler<kValueFieldType, Value>;
0072
0073
0074
0075 using KeyOnMemory = typename KeyTypeHandler::TypeOnMemory;
0076 using ValueOnMemory = typename ValueTypeHandler::TypeOnMemory;
0077
0078 public:
0079 #if !defined(PROTOBUF_CUSTOM_VTABLE)
0080 constexpr MapEntry() {}
0081 #endif
0082 using Message::Message;
0083
0084 MapEntry(const MapEntry&) = delete;
0085 MapEntry& operator=(const MapEntry&) = delete;
0086
0087 ~MapEntry() PROTOBUF_OVERRIDE {
0088
0089
0090
0091
0092 static_assert(!std::is_base_of<Message, Value>::value ||
0093 std::is_same<Message, Value>::value,
0094 "");
0095
0096 if (GetArena() != nullptr) return;
0097 SharedDtor(*this);
0098 }
0099
0100 using InternalArenaConstructable_ = void;
0101 using DestructorSkippable_ = void;
0102
0103 struct _Internal;
0104
0105 protected:
0106 friend class google::protobuf::Arena;
0107
0108 static void SharedDtor(MessageLite& msg) {
0109 auto& this_ = static_cast<MapEntry&>(msg);
0110 this_._internal_metadata_.template Delete<UnknownFieldSet>();
0111 KeyTypeHandler::DeleteNoArena(this_._impl_.key_);
0112 ValueTypeHandler::DeleteNoArena(this_._impl_.value_);
0113 }
0114
0115
0116
0117 struct {
0118 HasBits<1> _has_bits_{};
0119 CachedSize _cached_size_{};
0120
0121 KeyOnMemory key_{KeyTypeHandler::Constinit()};
0122 ValueOnMemory value_{ValueTypeHandler::Constinit()};
0123 } _impl_;
0124 };
0125
0126 template <typename Key, typename Value, WireFormatLite::FieldType kKeyFieldType,
0127 WireFormatLite::FieldType kValueFieldType>
0128 struct MapEntry<Key, Value, kKeyFieldType, kValueFieldType>::_Internal {
0129 static constexpr ::int32_t kHasBitsOffset =
0130 8 * PROTOBUF_FIELD_OFFSET(MapEntry, _impl_._has_bits_);
0131 };
0132
0133 }
0134 }
0135 }
0136
0137 #include "google/protobuf/port_undef.inc"
0138
0139 #endif