class RepeatedFieldAccessor
Defined at line 285 of file ../../third_party/protobuf/src/google/protobuf/reflection.h
Interfaces used to implement reflection RepeatedFieldRef API.
Reflection::GetRepeatedAccessor() should return a pointer to an singleton
object that implements the below interface.
This interface passes/returns values using void pointers. The actual type
of the value depends on the field's cpp_type. Following is a mapping from
cpp_type to the type that should be used in this interface:
field->cpp_type() T Actual type of void*
CPPTYPE_INT32 int32_t int32_t
CPPTYPE_UINT32 uint32_t uint32_t
CPPTYPE_INT64 int64_t int64_t
CPPTYPE_UINT64 uint64_t uint64_t
CPPTYPE_DOUBLE double double
CPPTYPE_FLOAT float float
CPPTYPE_BOOL bool bool
CPPTYPE_ENUM generated enum type int32_t
CPPTYPE_STRING string std::string
CPPTYPE_MESSAGE generated message type google::protobuf::Message
or google::protobuf::Message
Note that for enums we use int32_t in the interface.
You can map from T to the actual type using RefTypeTraits:
typedef RefTypeTraits
<T
>::AccessorValueType ActualType;
Public Methods
bool IsEmpty (const Field * data)
int Size (const Field * data)
const Value * Get (const Field * data, int index, Value * scratch_space)
Depends on the underlying representation of the repeated field, this
method can return a pointer to the underlying object if such an object
exists, or fill the data into scratch_space and return scratch_space.
Callers of this method must ensure scratch_space is a valid pointer
to a mutable object of the correct type.
void Clear (Field * data)
void Set (Field * data, int index, const Value * value)
void Add (Field * data, const Value * value)
void RemoveLast (Field * data)
void Reserve (Field * data, int size)
void SwapElements (Field * data, int index1, int index2)
void Swap (Field * data, const RepeatedFieldAccessor * other_mutator, Field * other_data)
Iterator * BeginIterator (const Field * data)
Create an iterator that points at the beginning of the repeated field.
Iterator * EndIterator (const Field * data)
Create an iterator that points at the end of the repeated field.
Iterator * CopyIterator (const Field * data, const Iterator * iterator)
Make a copy of an iterator and return the new copy.
Iterator * AdvanceIterator (const Field * data, Iterator * iterator)
Move an iterator to point to the next element.
bool EqualsIterator (const Field * data, const Iterator * a, const Iterator * b)
Compare whether two iterators point to the same element.
void DeleteIterator (const Field * data, Iterator * iterator)
Delete an iterator created by BeginIterator(), EndIterator() and
CopyIterator().
template <typename T>
T Get (const Field * data, int index)
Templated methods that make using this interface easier for non-message
types.
Defined at line 335 of file ../../third_party/protobuf/src/google/protobuf/reflection.h
const Value * GetIteratorValue (const Field * data, const Iterator * iterator, Value * scratch_space)
Like Get() but for iterators.
template <typename T, typename ValueType>
void Set (Field * data, int index, const ValueType & value)
Defined at line 343 of file ../../third_party/protobuf/src/google/protobuf/reflection.h
template <typename T, typename ValueType>
void Add (Field * data, const ValueType & value)
Defined at line 357 of file ../../third_party/protobuf/src/google/protobuf/reflection.h
Protected Methods
void ~RepeatedFieldAccessor ()
We want the destructor to be completely trivial as to allow it to be
a function local static. Hence we make it non-virtual and protected,
this class only live as part of a global singleton and should not be
deleted.
Defined at line 375 of file ../../third_party/protobuf/src/google/protobuf/reflection.h