Lines Matching +full:object +full:- +full:schema
8 * http://www.apache.org/licenses/LICENSE-2.0
21 const reflection::Field* GetFieldOrNull(const reflection::Object* type, in GetFieldOrNull()
23 TC3_CHECK(type != nullptr && type->fields() != nullptr); in GetFieldOrNull()
24 return type->fields()->LookupByKey(field_name.data()); in GetFieldOrNull()
27 const reflection::Field* GetFieldOrNull(const reflection::Object* type, in GetFieldOrNull()
29 if (type->fields() == nullptr) { in GetFieldOrNull()
32 for (const reflection::Field* field : *type->fields()) { in GetFieldOrNull()
33 if (field->offset() == field_offset) { in GetFieldOrNull()
40 const reflection::Field* GetFieldOrNull(const reflection::Object* type, in GetFieldOrNull()
44 // schema data, so try that first. in GetFieldOrNull()
51 const reflection::Field* GetFieldOrNull(const reflection::Object* type, in GetFieldOrNull()
54 if (field->field_name() == nullptr) { in GetFieldOrNull()
55 return GetFieldOrNull(type, field->field_offset()); in GetFieldOrNull()
59 StringPiece(field->field_name()->data(), field->field_name()->size()), in GetFieldOrNull()
60 field->field_offset()); in GetFieldOrNull()
63 const reflection::Field* GetFieldOrNull(const reflection::Object* type, in GetFieldOrNull()
66 return GetFieldOrNull(type, field->field_name, field->field_offset); in GetFieldOrNull()
69 const reflection::Object* TypeForName(const reflection::Schema* schema, in TypeForName() argument
71 for (const reflection::Object* object : *schema->objects()) { in TypeForName()
72 if (type_name.Equals(object->name()->str())) { in TypeForName()
73 return object; in TypeForName()
79 Optional<int> TypeIdForObject(const reflection::Schema* schema, in TypeIdForObject() argument
80 const reflection::Object* type) { in TypeIdForObject()
81 for (int i = 0; i < schema->objects()->size(); i++) { in TypeIdForObject()
82 if (schema->objects()->Get(i) == type) { in TypeIdForObject()
89 Optional<int> TypeIdForName(const reflection::Schema* schema, in TypeIdForName() argument
91 for (int i = 0; i < schema->objects()->size(); i++) { in TypeIdForName()
92 if (type_name.Equals(schema->objects()->Get(i)->name()->str())) { in TypeIdForName()
99 bool SwapFieldNamesForOffsetsInPath(const reflection::Schema* schema, in SwapFieldNamesForOffsetsInPath() argument
101 if (schema == nullptr || !schema->root_table()) { in SwapFieldNamesForOffsetsInPath()
102 TC3_LOG(ERROR) << "Empty schema provided."; in SwapFieldNamesForOffsetsInPath()
106 reflection::Object const* type = schema->root_table(); in SwapFieldNamesForOffsetsInPath()
107 for (int i = 0; i < path->field.size(); i++) { in SwapFieldNamesForOffsetsInPath()
108 const reflection::Field* field = GetFieldOrNull(type, path->field[i].get()); in SwapFieldNamesForOffsetsInPath()
110 TC3_LOG(ERROR) << "Could not find field: " << path->field[i]->field_name; in SwapFieldNamesForOffsetsInPath()
113 path->field[i]->field_name.clear(); in SwapFieldNamesForOffsetsInPath()
114 path->field[i]->field_offset = field->offset(); in SwapFieldNamesForOffsetsInPath()
117 if (i < path->field.size() - 1) { in SwapFieldNamesForOffsetsInPath()
118 if (field->type()->base_type() != reflection::Obj) { in SwapFieldNamesForOffsetsInPath()
119 TC3_LOG(ERROR) << "Field: " << field->name()->str() in SwapFieldNamesForOffsetsInPath()
120 << " is not of type `Object`."; in SwapFieldNamesForOffsetsInPath()
123 type = schema->objects()->Get(field->type()->index()); in SwapFieldNamesForOffsetsInPath()
129 Variant ParseEnumValue(const reflection::Schema* schema, in ParseEnumValue() argument
132 TC3_CHECK_NE(schema->enums(), nullptr); in ParseEnumValue()
133 const auto* enum_values = schema->enums()->Get(type->index())->values(); in ParseEnumValue()
139 if (value.Equals(StringPiece(enum_value->name()->c_str(), in ParseEnumValue()
140 enum_value->name()->size()))) { in ParseEnumValue()
141 const int64 value = enum_value->value(); in ParseEnumValue()
142 switch (type->base_type()) { in ParseEnumValue()