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