| 50 | } |
| 51 | |
| 52 | double GetAnyValueF(reflection::BaseType type, const uint8_t *data) { |
| 53 | switch (type) { |
| 54 | case reflection::Float: return static_cast<double>(ReadScalar<float>(data)); |
| 55 | case reflection::Double: return ReadScalar<double>(data); |
| 56 | case reflection::String: { |
| 57 | auto s = |
| 58 | reinterpret_cast<const String *>(ReadScalar<uoffset_t>(data) + data); |
| 59 | if (s) { |
| 60 | double d; |
| 61 | StringToNumber(s->c_str(), &d); |
| 62 | return d; |
| 63 | } else { |
| 64 | return 0.0; |
| 65 | } |
| 66 | } |
| 67 | default: return static_cast<double>(GetAnyValueI(type, data)); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | std::string GetAnyValueS(reflection::BaseType type, const uint8_t *data, |
| 72 | const reflection::Schema *schema, int type_index) { |
no test coverage detected