Go to the documentation of this file.
110 #ifndef GOOGLE_PROTOBUF_MESSAGE_H__
111 #define GOOGLE_PROTOBUF_MESSAGE_H__
115 #include <type_traits>
118 #include <google/protobuf/stubs/casts.h>
119 #include <google/protobuf/stubs/common.h>
120 #include <google/protobuf/arena.h>
121 #include <google/protobuf/descriptor.h>
122 #include <google/protobuf/generated_message_reflection.h>
123 #include <google/protobuf/generated_message_util.h>
124 #include <google/protobuf/message_lite.h>
125 #include <google/protobuf/port.h>
128 #define GOOGLE_PROTOBUF_HAS_ONEOF
129 #define GOOGLE_PROTOBUF_HAS_ARENAS
131 #include <google/protobuf/port_def.inc>
134 #error "You cannot SWIG proto headers"
143 class MessageFactory;
146 class AssignDescriptorsHelper;
148 class DynamicMessageReflectionHelper;
149 class GeneratedMessageReflectionTestHelper;
151 class MapValueConstRef;
154 class MapReflectionTester;
157 struct DescriptorTable;
159 class SwapFieldHelper;
170 class MapReflectionFriend;
171 class MessageReflectionFriend;
174 class CelMapReflectionFriend;
178 class MapFieldPrinterHelper;
181 class MessageDifferencer;
186 class ReflectionAccessor;
190 class MapFieldReflectionTest;
193 template <
typename T>
196 template <
typename T>
197 class RepeatedPtrField;
208 return reinterpret_cast<To*
>(
reinterpret_cast<char*
>(
message) +
offset);
213 return reinterpret_cast<const To*
>(
reinterpret_cast<const char*
>(
message) +
267 void CheckInitialized()
const;
277 std::string InitializationErrorString()
const override;
299 virtual size_t SpaceUsedLong()
const;
301 PROTOBUF_DEPRECATED_MSG(
"Please use SpaceUsedLong() instead")
314 void PrintDebugString()
const;
321 void Clear()
override;
327 void CheckTypeAndMergeFrom(
const MessageLite& other)
override;
331 size_t ByteSizeLong()
const override;
343 virtual void SetCachedSize(
int size)
const;
363 virtual Metadata GetMetadata()
const = 0;
389 size_t MaybeComputeUnknownFieldsSize(
size_t total_size,
403 class RepeatedFieldAccessor;
408 template <
typename T,
typename Enable =
void>
409 class RepeatedFieldRef;
411 template <
typename T,
typename Enable =
void>
412 class MutableRepeatedFieldRef;
452 class PROTOBUF_EXPORT Reflection final {
466 PROTOBUF_DEPRECATED_MSG(
"Please use SpaceUsedLong() instead")
517 const std::vector<const FieldDescriptor*>&
fields)
const;
529 void UnsafeArenaSwapFields(
531 const std::vector<const FieldDescriptor*>&
fields)
const;
542 std::vector<const FieldDescriptor*>*
output)
const;
658 PROTOBUF_NODISCARD
Message* ReleaseMessage(
817 template <
typename T>
823 template <
typename T>
844 template <
typename T>
845 PROTOBUF_DEPRECATED_MSG(
"Please use GetRepeatedFieldRef() instead")
848 return GetRepeatedFieldInternal<T>(
msg, d);
854 template <
typename T>
855 PROTOBUF_DEPRECATED_MSG(
"Please use GetMutableRepeatedFieldRef() instead")
858 return MutableRepeatedFieldInternal<T>(
msg, d);
865 template <
typename T>
866 PROTOBUF_DEPRECATED_MSG(
"Please use GetRepeatedFieldRef() instead")
869 return GetRepeatedPtrFieldInternal<T>(
msg, d);
876 template <
typename T>
877 PROTOBUF_DEPRECATED_MSG(
"Please use GetMutableRepeatedFieldRef() instead")
880 return MutableRepeatedPtrFieldInternal<T>(
msg, d);
924 bool SupportsUnknownEnumValues()
const;
938 template <
typename T>
941 template <
typename T>
944 template <
typename T>
947 template <
typename T>
989 void ListFieldsOmitStripped(
991 std::vector<const FieldDescriptor*>*
output)
const;
999 void ListFieldsMayFailOnStripped(
1001 std::vector<const FieldDescriptor*>*
output)
const;
1012 return IsLazilyVerifiedLazyField(
field) ||
1013 IsEagerlyVerifiedLazyField(
field);
1024 friend class FastReflectionMessageMutator;
1034 int last_non_weak_field_index_;
1036 template <
typename T,
typename Enable>
1038 template <
typename T,
typename Enable>
1040 friend class ::PROTOBUF_NAMESPACE_ID::MessageLayoutInspector;
1041 friend class ::PROTOBUF_NAMESPACE_ID::AssignDescriptorsHelper;
1048 #define GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
1049 friend class expr::CelMapReflectionFriend;
1050 friend class internal::MapFieldReflectionTest;
1051 friend class internal::MapKeySorter;
1052 friend class internal::WireFormat;
1053 friend class internal::ReflectionOps;
1069 bool is_string)
const;
1112 friend class WireFormatForMapFieldTest;
1125 template <
typename Type>
1128 template <
typename Type>
1130 template <
typename Type>
1161 inline const uint32_t* GetInlinedStringDonatedArray(
1169 void UnsafeShallowSwapFields(
1171 const std::vector<const FieldDescriptor*>&
fields)
const;
1179 void UnsafeShallowSwapField(
Message* message1,
Message* message2,
1182 template <
bool unsafe_shallow_swap>
1184 const std::vector<const FieldDescriptor*>&
fields)
const;
1186 template <
bool unsafe_shallow_swap>
1197 template <
typename Type>
1200 template <
typename Type>
1203 template <
typename Type>
1206 template <
typename Type>
1210 template <
typename Type>
1214 template <
typename Type>
1217 template <
typename Type>
1221 template <
typename Type>
1224 template <
typename Type>
1258 class PROTOBUF_EXPORT MessageFactory {
1307 static void InternalRegisterGeneratedFile(
1321 #define DECLARE_GET_REPEATED_FIELD(TYPE) \
1323 PROTOBUF_EXPORT const RepeatedField<TYPE>& \
1324 Reflection::GetRepeatedFieldInternal<TYPE>( \
1325 const Message& message, const FieldDescriptor* field) const; \
1328 PROTOBUF_EXPORT RepeatedField<TYPE>* \
1329 Reflection::MutableRepeatedFieldInternal<TYPE>( \
1330 Message * message, const FieldDescriptor* field) const;
1340 #undef DECLARE_GET_REPEATED_FIELD
1349 template <
typename T>
1353 const T& (*get_default_instance)() = &T::default_instance;
1354 (void)get_default_instance;
1357 const Message* unused =
static_cast<T*
>(
nullptr);
1361 return dynamic_cast<const T*
>(
from);
1363 bool ok =
from !=
nullptr &&
1364 T::default_instance().GetReflection() ==
from->GetReflection();
1365 return ok ? down_cast<const T*>(
from) :
nullptr;
1369 template <
typename T>
1372 return const_cast<T*
>(DynamicCastToGenerated<T>(message_const));
1395 template <
typename T>
1408 inline const RepeatedPtrField<std::string>&
1409 Reflection::GetRepeatedPtrFieldInternal<std::string>(
1416 inline RepeatedPtrField<std::string>*
1417 Reflection::MutableRepeatedPtrFieldInternal<std::string>(
1440 template <
typename PB>
1448 template <
typename PB>
1451 return static_cast<RepeatedPtrField<PB>*
>(
1456 template <
typename Type>
1464 return internal::GetConstRefAtOffset<uint32_t>(
1474 template <
typename Type>
1478 <<
"Field = " <<
field->full_name();
1479 return internal::GetConstRefAtOffset<Type>(
message,
1485 #include <google/protobuf/port_undef.inc>
1487 #endif // GOOGLE_PROTOBUF_MESSAGE_H__
uint32 GetOneofCaseOffset(const OneofDescriptor *oneof_descriptor) const
uint32 GetOneofCase(const Message &message, const OneofDescriptor *oneof_descriptor) const
void Swap(T &lhs, T &rhs) noexcept(IsNothrowSwappable< T >::value)
bool HasOneofField(const Message &message, const FieldDescriptor *field) const
const Descriptor::ReservedRange value
#define DECLARE_GET_REPEATED_FIELD(TYPE)
const To & GetConstRefAtOffset(const Message &message, uint32_t offset)
#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName)
GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream
const RepeatedPtrField< T > & GetRepeatedPtrFieldInternal(const Message &message, const FieldDescriptor *field) const
const void * GetFieldDefault(const FieldDescriptor *field) const
const Reflection * GetReflection() const
static PyObject * CopyFrom(CMessage *self, PyObject *arg)
std::string DebugString(const google::protobuf::Message &message)
GRPC_CUSTOM_DYNAMICMESSAGEFACTORY DynamicMessageFactory
GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream
const internal::ReflectionSchema schema_
std::string GetTypeName()
bool IsLazyField(const FieldDescriptor *field) const
ExtensionSet * GetExtensionSet(MessageLite *msg, int64 extension_offset)
uint32 GetFieldOffset(const FieldDescriptor *field) const
static PyObject * UnknownFieldSet(CMessage *self)
#define T(upbtypeconst, upbtype, ctype, default_value)
grpc_core::ScopedArenaPtr arena
void SetField(uint64 val, const FieldDescriptor *field, Message *msg, const Reflection *reflection)
static PyObject * AddMessage(RepeatedCompositeContainer *self, PyObject *value)
Message(Arena *arena, bool is_message_owned=false)
int ToIntSize(size_t size)
GRPC_CUSTOM_MESSAGELITE MessageLite
void LinkMessageReflection()
unsigned __int64 uint64_t
const char * ParsePackedField(const FieldDescriptor *field, Message *msg, const Reflection *reflection, const char *ptr, internal::ParseContext *ctx)
GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream
T ClearBit(T *i, size_t n)
const void * GetRawRepeatedField(const Message &message, const FieldDescriptor *field, FieldDescriptor::CppType cpptype, int ctype, const Descriptor *message_type) const
GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream
const To * GetConstPointerAtOffset(const Message *message, uint32_t offset)
bool CreateUnknownEnumValues(const FieldDescriptor *field)
FieldDescriptorProto * AddField(DescriptorProto *parent, const std::string &name, int number, FieldDescriptorProto::Label label, FieldDescriptorProto::Type type)
Type * MutableField(MessageLite *msg, uint32 *has_bits, uint32 has_bit_index, int64 offset)
void * MutableRawRepeatedField(Message *message, const FieldDescriptor *field, FieldDescriptor::CppType, int ctype, const Descriptor *message_type) const
static bool GetString(std::string *out, CBS *cbs)
const FieldDescriptor * field
const Descriptor * GetDescriptor() const
bool HasExtensionSet(const Message &) const
const Type & DefaultRaw(const FieldDescriptor *field) const
bool IsMessageStripped(const Descriptor *descriptor) const
const T * DynamicCastToGenerated(const Message *from)
const char * ParseLenDelim(int field_number, const FieldDescriptor *field, Message *msg, const Reflection *reflection, const char *ptr, internal::ParseContext *ctx)
const Type & GetRaw(const Message &message, const FieldDescriptor *field) const
void RegisterAllTypesInternal(const Metadata *file_level_metadata, int size)
EnumDescriptorProto * AddEnum(FileDescriptorProto *file, const std::string &name)
void StrongReference(const T &var)
InternalDescriptorPool * pool
To * GetPointerAtOffset(Message *message, uint32_t offset)
virtual const ClassData * GetClassData() const
size_t ComputeUnknownFieldsSize(const InternalMetadataWithArena &metadata, size_t total_size, CachedSize *cached_size)
std::vector< std::pair< std::string, std::string > > Metadata
void ClearOneofField(const ParseTableField &field, Arena *arena, MessageLite *msg)
EnumValueDescriptorProto * AddEnumValue(EnumDescriptorProto *enum_proto, const std::string &name, int number)
bool HasExtensionSet() const
RepeatedPtrField< T > * MutableRepeatedPtrFieldInternal(Message *message, const FieldDescriptor *field) const
static const char descriptor[1336]
static ParentDescriptor GetDescriptor(PyContainer *self)
FieldDescriptor::CppType cpp_type(FieldType type)
bool InRealOneof(const FieldDescriptor *field) const
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:25