| 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 { |
nothing calls this directly
no outgoing calls
no test coverage detected