MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / Set

Function Set

libapp2sys/prebuilt/include/google/protobuf/reflection.h:405–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403
404 template<typename T, typename ValueType>
405 void Set(Field* data, int index, const ValueType& value) const {
406 typedef typename RefTypeTraits<T>::AccessorValueType ActualType;
407 // In this RepeatedFieldAccessor interface we pass/return data using
408 // raw pointers. Type of the data these raw pointers point to should
409 // be ActualType. Here we have a ValueType object and want a ActualType
410 // pointer. We can't cast a ValueType pointer to an ActualType pointer
411 // directly because their type might be different (for enums ValueType
412 // may be a generated enum type while ActualType is int32). To be safe
413 // we make a copy to get a temporary ActualType object and use it.
414 ActualType tmp = static_cast<ActualType>(value);
415 Set(data, index, static_cast<const Value*>(&tmp));
416 }
417
418 template<typename T, typename ValueType>
419 void Add(Field* data, const ValueType& value) const {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected