本文整理汇总了C++中xml::ElementPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ElementPtr类的具体用法?C++ ElementPtr怎么用?C++ ElementPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ElementPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _load
void PluginManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
xml::ElementEnumerator node = _node->getElementEnumerator();
while (node.next())
{
if (node->getName() == "path")
{
std::string source;
if (node->findAttribute("source", source))
loadPlugin(source);
}
else if (node->getName() == "Plugin")
{
std::string source;
xml::ElementEnumerator source_node = node->getElementEnumerator();
while (source_node.next("Source"))
{
std::string build = source_node->findAttribute("build");
#if MYGUI_DEBUG_MODE == 1
if (build == "Debug")
source = source_node->getContent();
#else
if (build != "Debug")
source = source_node->getContent();
#endif
}
if (!source.empty())
loadPlugin(source);
}
}
}
示例2: deserialization
void OgreFont::deserialization(xml::ElementPtr _node, Version _version)
{
xml::ElementEnumerator node = _node->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Property")
{
const std::string& key = node->findAttribute("key");
const std::string& value = node->findAttribute("value");
// 中文处理
if (key == "Source") mSource = value;
else if (key == "Size") mSize = utility::parseInt(value);
else if (key == "Resolution") mResolution = utility::parseUInt(value);
else if (key == "SpaceWidth") mSpaceWidth = utility::parseInt(value);
else if (key == "TabWidth") mTabWidth = utility::parseInt(value);
else if (key == "OffsetHeight") mOffsetHeight = utility::parseInt(value);
else if (key == "SubstituteCode") mSubstituteCodePoint = utility::parseInt(value);
else if (key == "CursorWidth") mCursorWidth = utility::parseInt(value);
else if (key == "Distance") mDistance = utility::parseInt(value);
else if (key == "Bold") mBold = utility::parseBool(value);
else if (key == "Italic") mItalic = utility::parseBool(value);
}
}
initialise();
}
示例3: deserialization
void OverlappedLayer::deserialization(xml::ElementPtr _node, Version _version)
{
mName = _node->findAttribute("name");
if (_version >= Version(1, 2))
{
MyGUI::xml::ElementEnumerator propert = _node->getElementEnumerator();
while (propert.next("Property"))
{
const std::string& key = propert->findAttribute("key");
const std::string& value = propert->findAttribute("value");
if (key == "Pick") mIsPick = utility::parseValue<bool>(value);
}
}
else
{
mIsPick = utility::parseBool(_version < Version(1, 0) ? _node->findAttribute("peek") : _node->findAttribute("pick"));
}
}
示例4: deserialization
void ResourceLayout::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
mLayoutData.clear();
xml::ElementEnumerator widget = _node->getElementEnumerator();
while (widget.next("Widget"))
mLayoutData.push_back(parseWidget(widget));
}
示例5: _load
void LanguageManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
std::string default_lang;
bool event_change = false;
// берем детей и крутимся, основной цикл
xml::ElementEnumerator root = _node->getElementEnumerator();
while (root.next(XML_TYPE))
{
// парсим атрибуты
root->findAttribute("default", default_lang);
// берем детей и крутимся
xml::ElementEnumerator info = root->getElementEnumerator();
while (info.next("Info"))
{
// парсим атрибуты
std::string name(info->findAttribute("name"));
// доюавляем в карту пользователя
if (name.empty())
{
xml::ElementEnumerator source_info = info->getElementEnumerator();
while (source_info.next("Source"))
{
loadLanguage(source_info->getContent(), true);
}
}
// добавляем в карту языков
else
{
xml::ElementEnumerator source_info = info->getElementEnumerator();
while (source_info.next("Source"))
{
std::string file_source = source_info->getContent();
// добавляем в карту
mMapFile[name].push_back(file_source);
// если добавляемый файл для текущего языка, то подгружаем и оповещаем
if (name == mCurrentLanguageName)
{
loadLanguage(file_source, false);
event_change = true;
}
}
}
}
}
if (!default_lang.empty())
setCurrentLanguage(default_lang);
else if (event_change)
eventChangeLanguage(mCurrentLanguageName);
}
示例6: _loadList
void ResourceManager::_loadList(xml::ElementPtr _node, const std::string& _file, Version _version)
{
// берем детей и крутимся, основной цикл
xml::ElementEnumerator node = _node->getElementEnumerator();
while (node.next(XML_TYPE_LIST))
{
std::string source;
if (!node->findAttribute("file", source)) continue;
MYGUI_LOG(Info, "Load ini file '" << source << "'");
_loadImplement(source, false, "", INSTANCE_TYPE_NAME);
}
}
示例7: deserialization
void RTTLayer::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
MyGUI::xml::ElementEnumerator propert = _node->getElementEnumerator();
while (propert.next("Property"))
{
const std::string& key = propert->findAttribute("key");
const std::string& value = propert->findAttribute("value");
if (key == "TextureSize") setTextureSize(utility::parseValue<IntSize>(value));
if (key == "TextureName") setTextureName(value);
}
}
示例8: _load
void ResourceManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
FactoryManager& factory = FactoryManager::getInstance();
VectorGuid vector_guid;
// берем детей и крутимся, основной цикл
xml::ElementEnumerator root = _node->getElementEnumerator();
while (root.next(XML_TYPE))
{
// парсим атрибуты
std::string id, type, name;
root->findAttribute("type", type);
root->findAttribute("name", name);
root->findAttribute("id", id);
Guid guid(id);
if (!guid.empty())
{
if (mResourcesID.find(guid) != mResourcesID.end())
{
MYGUI_LOG(Warning, "dublicate resource id " << guid.print());
}
}
if (mResources.find(name) != mResources.end())
{
MYGUI_LOG(Warning, "dublicate resource name '" << name << "'");
}
vector_guid.push_back(guid);
IObject* object = factory.createObject(XML_TYPE, type);
if (object == nullptr)
{
MYGUI_LOG(Error, "resource type '" << type << "' not found");
continue;
}
IResourcePtr resource = object->castType<IResource>();
resource->deserialization(root.current(), _version);
if (!guid.empty()) mResourcesID[guid] = resource;
if (!name.empty()) mResources[name] = resource;
}
if (!vector_guid.empty())
{
mListFileGuid[_file] = vector_guid;
}
}
示例9: deserialization
void ResourceManualPointer::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
// берем детей и крутимся, основной цикл
xml::ElementEnumerator info = _node->getElementEnumerator();
while (info.next("Property"))
{
const std::string& key = info->findAttribute("key");
const std::string& value = info->findAttribute("value");
if (key == "Point") mPoint = IntPoint::parse(value);
else if (key == "Size") mSize = IntSize::parse(value);
else if (key == "Texture") mTexture = value;
else if (key == "Coord") mTextureCoord = IntCoord::parse(value);
}
}
示例10: deserialization
void ResourceImageSet::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
// берем детей и крутимся, основной цикл
xml::ElementEnumerator group_node = _node->getElementEnumerator();
while (group_node.next("Group"))
{
GroupImage group;
group.name = group_node->findAttribute("name");
group.texture = group_node->findAttribute("texture");
// поддержка замены тегов
if (_version >= Version(1, 1))
{
group.texture = LanguageManager::getInstance().replaceTags(group.texture);
}
group.size = IntSize::parse(group_node->findAttribute("size"));
xml::ElementEnumerator index_node = group_node->getElementEnumerator();
while (index_node.next("Index"))
{
IndexImage index;
index.name = index_node->findAttribute("name");
index.rate = utility::parseFloat(index_node->findAttribute("rate"));
xml::ElementEnumerator frame_node = index_node->getElementEnumerator();
while (frame_node.next("Frame"))
{
size_t count = utility::parseSizeT(frame_node->findAttribute("count"));
const IntPoint& point = IntPoint::parse(frame_node->findAttribute("point"));
if ((count < 1) || (count > 256)) count = 1;
while (count > 0)
{
index.frames.push_back(point);
-- count;
}
}
group.indexes.push_back(index);
}
AddGroupImage(group);
}
}
示例11: _load
void LanguageManager::_load(xml::ElementPtr _node, const std::string & _file, Version _version)
{
std::string def;
// берем детей и крутимся, основной цикл
xml::ElementEnumerator root = _node->getElementEnumerator();
while (root.next(XML_TYPE)) {
// парсим атрибуты
root->findAttribute("default", def);
// берем детей и крутимся
xml::ElementEnumerator info = root->getElementEnumerator();
while (info.next("Info")) {
// парсим атрибуты
std::string name(info->findAttribute("name"));
// доюавляем в карту пользователя
if (name.empty()) {
xml::ElementEnumerator source_info = info->getElementEnumerator();
while (source_info.next("Source")) {
loadLanguage(source_info->getContent(), ResourceManager::getInstance().getResourceGroup(), true);
};
}
// добавляем в карту языков
else {
MapListString::iterator lang = mMapFile.find(name);
if (lang == mMapFile.end()) {
lang = mMapFile.insert(std::make_pair(name, VectorString())).first;
}
xml::ElementEnumerator source_info = info->getElementEnumerator();
while (source_info.next("Source")) {
lang->second.push_back(source_info->getContent());
};
}
};
};
if ( ! def.empty()) setCurrentLanguage(def);
}
示例12: deserialization
void ResourceManualFont::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
xml::ElementEnumerator node = _node->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Property")
{
const std::string& key = node->findAttribute("key");
const std::string& value = node->findAttribute("value");
if (key == "Source") mSource = value;
else if (key == "DefaultHeight") mDefaultHeight = utility::parseInt(value);
}
else if (node->getName() == "Codes")
{
xml::ElementEnumerator range = node->getElementEnumerator();
while (range.next("Code"))
{
std::string range_value;
std::vector<std::string> parse_range;
// описане глифов
if (range->findAttribute("index", range_value))
{
Char id = 0;
if (range_value == "cursor")
id = FontCodeType::Cursor;
else if (range_value == "selected")
id = FontCodeType::Selected;
else if (range_value == "selected_back")
id = FontCodeType::SelectedBack;
else
id = utility::parseUInt(range_value);
addGlyph(id, utility::parseValue<IntCoord>(range->findAttribute("coord")));
}
}
}
}
// инициализируем
initialise();
}
示例13: _load
void SkinManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
// берем детей и крутимся, основной цикл со скинами
xml::ElementEnumerator skin = _node->getElementEnumerator();
while (skin.next(XML_TYPE))
{
/*std::string name = */skin->findAttribute("name");
std::string type = skin->findAttribute("type");
if (type.empty())
type = "ResourceSkin";
IObject* object = FactoryManager::getInstance().createObject(XML_TYPE_RESOURCE, type);
if (object != nullptr)
{
ResourceSkin* data = object->castType<ResourceSkin>();
data->deserialization(skin.current(), _version);
ResourceManager::getInstance().addResource(data);
}
}
}
示例14: _load
void LayerManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
VectorLayer layers;
// берем детей и крутимся, основной цикл
xml::ElementEnumerator layer = _node->getElementEnumerator();
while (layer.next(mCategoryName))
{
std::string name;
if ( !layer->findAttribute("name", name))
{
MYGUI_LOG(Warning, "Attribute 'name' not found (file : " << _file << ")");
continue;
}
for (VectorLayer::iterator iter = layers.begin(); iter != layers.end(); ++iter)
{
MYGUI_ASSERT((*iter)->getName() != name, "Layer '" << name << "' already exist (file : " << _file << ")");
}
std::string type = layer->findAttribute("type");
if (type.empty() && _version <= Version(1, 0))
{
bool overlapped = utility::parseBool(layer->findAttribute("overlapped"));
type = overlapped ? "OverlappedLayer" : "SharedLayer";
}
IObject* object = FactoryManager::getInstance().createObject(mCategoryName, type);
MYGUI_ASSERT(object != nullptr, "factory '" << type << "' is not found");
ILayer* item = object->castType<ILayer>();
item->deserialization(layer.current(), _version);
layers.push_back(item);
}
// теперь мержим новые и старые слои
merge(layers);
}
示例15: _load
void FontManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
#ifndef MYGUI_DONT_USE_OBSOLETE
loadOldFontFormat(_node, _file, _version, mXmlFontTagName);
#endif // MYGUI_DONT_USE_OBSOLETE
xml::ElementEnumerator node = _node->getElementEnumerator();
while (node.next())
{
if (node->getName() == mXmlPropertyTagName)
{
const std::string& key = node->findAttribute("key");
const std::string& value = node->findAttribute("value");
#ifdef MYGUI_USE_FREETYPE
if (key == "Default")
#else
if (key == "DefaultGenerated")
#endif
mDefaultName = value;
}
}
}