本文整理汇总了C++中TableDescriptor::LoadFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ TableDescriptor::LoadFrom方法的具体用法?C++ TableDescriptor::LoadFrom怎么用?C++ TableDescriptor::LoadFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableDescriptor
的用法示例。
在下文中一共展示了TableDescriptor::LoadFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
bool ObjectMgr::Initialize(IKernel * kernel) {
_kernel = kernel;
_nextTypeId = 1;
char path[512] = { 0 };
SafeSprintf(path, sizeof(path), "%s/config/object.xml", tools::GetAppPath());
olib::XmlReader conf;
if (!conf.LoadXml(path)) {
OASSERT(false, "load object.xml failed");
return false;
}
if (conf.Root().IsExist("prop")) {
const olib::IXmlObject& props = conf.Root()["prop"];
for (s32 i = 0; i < props.Count(); ++i)
_defines[props[i].GetAttributeString("name")] = (1 << i);
}
if (conf.Root().IsExist("table")) {
const olib::IXmlObject& tables = conf.Root()["table"];
for (s32 i = 0; i < tables.Count(); ++i) {
TableDescriptor * tableModel = NEW TableDescriptor();
const char * name = tables[i].GetAttributeString("name");
if (!tableModel->LoadFrom(tables[i]))
return false;
_tableModels[tools::CalcStringUniqueId(name)] = tableModel;
}
}
SafeSprintf(path, sizeof(path), "%s/config/dccenter/", tools::GetAppPath());
tools::ListFileInDirection(path, ".xml", [this](const char * name, const char * path) {
if (_namePathMap.end() != _namePathMap.find(name)) {
OASSERT(false, "prop xml name repeated");
return;
}
_namePathMap.insert(std::make_pair(name, path));
});
for (auto itr = _namePathMap.begin(); itr != _namePathMap.end(); ++itr)
CreateTemplate(kernel, itr->first.GetString());
return true;
}