MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / SetField

Function SetField

native/thirdpart/flatbuffers/reflection.h:286–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284// Set any scalar field, if you know its exact type.
285template<typename T>
286bool SetField(Table *table, const reflection::Field &field, T val) {
287 reflection::BaseType type = field.type()->base_type();
288 if (!IsScalar(type)) { return false; }
289 FLATBUFFERS_ASSERT(sizeof(T) == GetTypeSize(type));
290 T def;
291 if (IsInteger(type)) {
292 def = GetFieldDefaultI<T>(field);
293 } else {
294 FLATBUFFERS_ASSERT(IsFloat(type));
295 def = GetFieldDefaultF<T>(field);
296 }
297 return table->SetField(field.offset(), val, def);
298}
299
300// Raw helper functions used below: set any value in memory as a 64bit int, a
301// double or a string.

Callers

nothing calls this directly

Calls 5

GetTypeSizeFunction · 0.85
SetFieldMethod · 0.80
IsScalarFunction · 0.70
IsIntegerFunction · 0.70
IsFloatFunction · 0.70

Tested by

no test coverage detected