MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / LoadConfigMeta

Method LoadConfigMeta

src/plugin/kernel/src/AFCClassMetaModule.cpp:86–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86bool AFCClassMetaModule::LoadConfigMeta(const std::string& schema_path, std::shared_ptr<AFClassMeta> pClassMeta)
87{
88 std::string file_path = GetPluginManager()->GetResPath() + schema_path;
89
90 ARK_LOG_INFO("Load meta files: {}", schema_path);
91
92 AFXml xml_doc(file_path);
93 auto root_node = xml_doc.GetRootNode();
94 ARK_ASSERT_RET_VAL(root_node.IsValid(), false);
95
96 const std::string& class_name = pClassMeta->GetName();
97 for (auto meta_node = root_node.FindNode("meta"); meta_node.IsValid(); meta_node.NextNode())
98 {
99 std::string name = meta_node.GetString("field");
100 std::string type_name = meta_node.GetString("type");
101 uint32_t index = AFMetaNameIndex::GetIndex(class_name, name);
102
103 ArkDataType data_type = ConvertDataType(type_name);
104 ARK_ASSERT_RET_VAL(data_type != ArkDataType::DT_EMPTY, false);
105
106 auto pDataMeta = pClassMeta->CreateDataMeta(name, index);
107 ARK_ASSERT_RET_VAL(pDataMeta != nullptr, false);
108
109 pDataMeta->SetType(data_type);
110 }
111
112 return true;
113}
114
115bool AFCClassMetaModule::LoadEntity()
116{

Callers

nothing calls this directly

Calls 7

GetRootNodeMethod · 0.80
IsValidMethod · 0.80
NextNodeMethod · 0.80
CreateDataMetaMethod · 0.80
FindNodeMethod · 0.45
GetStringMethod · 0.45
SetTypeMethod · 0.45

Tested by

no test coverage detected