Go to the documentation of this file.
33 #ifndef GOOGLE_PROTOBUF_REFLECTION_H__
34 #define GOOGLE_PROTOBUF_REFLECTION_H__
38 #include <google/protobuf/message.h>
39 #include <google/protobuf/generated_enum_util.h>
42 #error "You cannot SWIG proto headers"
45 #include <google/protobuf/port_def.inc>
50 template <
typename T,
typename Enable =
void>
69 T, typename
std::enable_if<!std::is_base_of<Message, T>::value>
::type> {
104 template <
typename T>
106 T, typename
std::enable_if<!std::is_base_of<Message, T>::value>
::type> {
120 accessor_->SwapElements(
data_, index1, index2);
125 accessor_->Swap(
data_, other.accessor_, other.data_);
128 template <
typename Container>
130 typedef typename Container::const_iterator
Iterator;
135 template <
typename Container>
155 template <
typename T>
157 T, typename
std::enable_if<std::is_base_of<Message, T>::value>
::type> {
174 return *
static_cast<const T*
>(accessor_->Get(
data_,
index, scratch_space));
178 T*
NewMessage()
const {
return static_cast<T*
>(default_instance_->New()); }
215 template <
typename T>
217 T, typename
std::enable_if<std::is_base_of<Message, T>::value>
::type> {
225 return *
static_cast<const T*
>(accessor_->Get(
data_,
index, scratch_space));
229 T*
NewMessage()
const {
return static_cast<T*
>(default_instance_->New()); }
237 accessor_->SwapElements(
data_, index1, index2);
242 accessor_->Swap(
data_, other.accessor_, other.data_);
245 template <
typename Container>
247 typedef typename Container::const_iterator
Iterator;
252 template <
typename Container>
309 virtual int Size(
const Field*
data)
const = 0;
316 Value* scratch_space)
const = 0;
321 virtual void RemoveLast(
Field*
data)
const = 0;
322 virtual void SwapElements(
Field*
data,
int index1,
int index2)
const = 0;
324 Field* other_data)
const = 0;
345 Value* scratch_space)
const = 0;
349 template <
typename T>
352 ActualType scratch_space;
353 return static_cast<T>(*
reinterpret_cast<const ActualType*
>(
357 template <
typename T,
typename ValueType>
367 ActualType
tmp =
static_cast<ActualType
>(
value);
371 template <
typename T,
typename ValueType>
381 ActualType
tmp =
static_cast<ActualType
>(
value);
394 template <
typename T>
408 : accessor->EndIterator(
data)),
418 : accessor->EndIterator(
data)),
453 if (
this != &other) {
472 template <
typename T>
476 #define DEFINE_PRIMITIVE(TYPE, type) \
478 struct PrimitiveTraits<type> { \
479 static const bool is_primitive = true; \
480 static const FieldDescriptor::CppType cpp_type = \
481 FieldDescriptor::CPPTYPE_##TYPE; \
490 #undef DEFINE_PRIMITIVE
492 template <
typename T>
494 T, typename
std::enable_if<PrimitiveTraits<T>::is_primitive>
::type> {
504 template <
typename T>
506 T, typename
std::enable_if<is_proto_enum<T>::value>
::type> {
518 template <
typename T>
520 T, typename
std::enable_if<std::is_same<std::string, T>::value>
::type> {
531 template <
typename T>
534 return T::default_instance().GetDescriptor();
542 template <
typename T>
544 T, typename
std::enable_if<std::is_base_of<Message, T>::value>
::type> {
560 #include <google/protobuf/port_undef.inc>
562 #endif // GOOGLE_PROTOBUF_REFLECTION_H__
const Message * default_instance_
void Swap(T &lhs, T &rhs) noexcept(IsNothrowSwappable< T >::value)
const Descriptor::ReservedRange value
MutableRepeatedFieldRef(Message *message, const FieldDescriptor *field)
const Message * default_instance_
static const bool is_primitive
const T & Get(const void *ptr)
void SwapElements(int index1, int index2) const
const typedef T & IteratorValueType
void CopyFrom(const Container &container) const
RepeatedFieldAccessor AccessorType
IteratorType const_iterator
bool operator==(const RepeatedFieldRefIterator &other) const
Message AccessorValueType
std::string AccessorValueType
internal::RefTypeTraits< T >::AccessorType AccessorType
std::unique_ptr< AccessorValueType > scratch_space_
int32 * IteratorPointerType
RepeatedFieldRef< T > GetRepeatedFieldRef(const Message &message, const FieldDescriptor *field) const
RepeatedFieldRefIterator< T > iterator
void Set(int index, const T &value) const
MessageFactory * GetMessageFactory() const
virtual const Message * GetPrototype(const Descriptor *type)=0
void Add(const T &value) const
static PyObject * Add(PyObject *self, PyObject *file_descriptor_proto)
void Swap(const MutableRepeatedFieldRef &other) const
RepeatedFieldRefIterator(const void *data, const RepeatedFieldAccessor *accessor, bool begin, AccessorValueType *scratch_space)
internal::RefTypeTraits< T >::AccessorType AccessorType
const T & Get(int index, T *scratch_space) const
const typedef MCPhysReg * iterator
#define T(upbtypeconst, upbtype, ctype, default_value)
const typedef std::string IteratorValueType
virtual Iterator * AdvanceIterator(const Field *data, Iterator *iterator) const =0
RepeatedFieldRef(const Message &message, const FieldDescriptor *field)
static const Descriptor * GetMessageFieldDescriptor()
bool operator!=(const RepeatedFieldRefIterator &other) const
const typedef T & const_reference
RepeatedFieldRefIterator operator++(int)
RepeatedFieldRefIterator< T > iterator
MutableRepeatedFieldRef(Message *message, const FieldDescriptor *field)
RepeatedFieldRefIterator & operator=(const RepeatedFieldRefIterator &other)
internal::RefTypeTraits< T >::iterator IteratorType
void MergeFrom(const Container &container) const
virtual const Value * GetIteratorValue(const Field *data, const Iterator *iterator, Value *scratch_space) const =0
const internal::RepeatedFieldAccessor * RepeatedFieldAccessor(const FieldDescriptor *field) const
void Add(const T &value) const
MutableRepeatedFieldRef< T > GetMutableRepeatedFieldRef(Message *message, const FieldDescriptor *field) const
RepeatedFieldRefIterator(const RepeatedFieldRefIterator &other)
const typedef T & const_reference
const AccessorType * accessor_
void Set(Field *data, int index, const ValueType &value) const
#define DEFINE_PRIMITIVE(TYPE, type)
RepeatedFieldRefIterator< T > iterator
void Set(int index, const T &value) const
const AccessorType * accessor_
void * RepeatedFieldData(Message *message, const FieldDescriptor *field, FieldDescriptor::CppType cpp_type, const Descriptor *message_type) const
static const Descriptor * GetMessageFieldDescriptor()
ptrdiff_t difference_type
static const Descriptor * get()
RepeatedFieldRefIterator< T > iterator
void CopyFrom(const Container &container) const
ValueType
Type of the value held by a Value object.
static const Descriptor * get()
static const Descriptor * GetMessageFieldDescriptor()
const typedef std::string * IteratorPointerType
void Swap(const MutableRepeatedFieldRef &other) const
void MergeFrom(const Container &container) const
virtual Iterator * CopyIterator(const Field *data, const Iterator *iterator) const =0
RepeatedFieldAccessor AccessorType
const FieldDescriptor * field
void SwapElements(int index1, int index2) const
IteratorPointerType operator->() const
IteratorType const_iterator
virtual bool EqualsIterator(const Field *data, const Iterator *a, const Iterator *b) const =0
IteratorValueType operator*() const
RepeatedFieldRefIterator & operator++()
const T & Get(int index, T *scratch_space) const
RefTypeTraits< T >::IteratorPointerType IteratorPointerType
RepeatedFieldRef(const Message &message, const FieldDescriptor *field)
static const Descriptor * GetMessageFieldDescriptor()
T Get(const Field *data, int index) const
RefTypeTraits< T >::IteratorValueType IteratorValueType
const AccessorType * accessor_
RepeatedFieldRefIterator(const void *data, const RepeatedFieldAccessor *accessor, bool begin)
RepeatedFieldAccessor AccessorType
~RepeatedFieldRefIterator()
const RepeatedFieldAccessor * accessor_
const typedef T * IteratorPointerType
const AccessorType * accessor_
internal::RefTypeTraits< T >::AccessorType AccessorType
ptrdiff_t difference_type
void Add(Field *data, const ValueType &value) const
internal::RefTypeTraits< T >::AccessorType AccessorType
RefTypeTraits< T >::AccessorValueType AccessorValueType
virtual void DeleteIterator(const Field *data, Iterator *iterator) const =0
RepeatedFieldAccessor AccessorType
static struct async_container * container
FieldDescriptor::CppType cpp_type(FieldType type)
internal::RefTypeTraits< T >::iterator IteratorType
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:00