本文整理汇总了C++中xml::ElementPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ElementPtr类的具体用法?C++ ElementPtr怎么用?C++ ElementPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ElementPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:MyGUI,项目名称:mygui,代码行数:32,代码来源:MyGUI_PluginManager.cpp
示例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();
}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:26,代码来源:MyGUI_OgreFont.cpp
示例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"));
}
}
开发者ID:OndraK,项目名称:openmw,代码行数:18,代码来源:MyGUI_OverlappedLayer.cpp
示例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));
}
开发者ID:siangzhang,项目名称:starworld,代码行数:10,代码来源:MyGUI_ResourceLayout.cpp
示例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);
}
开发者ID:redkaras,项目名称:Demi3D,代码行数:55,代码来源:MyGUI_LanguageManager.cpp
示例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);
}
}
开发者ID:OndraK,项目名称:openmw,代码行数:12,代码来源:MyGUI_ResourceManager.cpp
示例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);
}
}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:13,代码来源:MyGUI_RTTLayer.cpp
示例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;
}
}
开发者ID:OndraK,项目名称:openmw,代码行数:51,代码来源:MyGUI_ResourceManager.cpp
示例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);
}
}
开发者ID:siangzhang,项目名称:starworld,代码行数:17,代码来源:MyGUI_ResourceManualPointer.cpp
示例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);
}
}
开发者ID:blunted2night,项目名称:MyGUI,代码行数:46,代码来源:MyGUI_ResourceImageSet.cpp
示例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);
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:44,代码来源:MyGUI_LanguageManager.cpp
示例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();
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:43,代码来源:MyGUI_ResourceManualFont.cpp
示例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);
}
}
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:21,代码来源:MyGUI_SkinManager.cpp
示例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);
}
开发者ID:blunted2night,项目名称:MyGUI,代码行数:40,代码来源:MyGUI_LayerManager.cpp
示例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;
}
}
}
开发者ID:asdlei00,项目名称:mygui,代码行数:22,代码来源:MyGUI_FontManager.cpp
示例16: loadFromXmlNode
void ResourceManager::loadFromXmlNode(xml::ElementPtr _node, const std::string& _file, Version _version)
{
FactoryManager& factory = FactoryManager::getInstance();
// берем детей и крутимся, основной цикл
xml::ElementEnumerator root = _node->getElementEnumerator();
while (root.next(XML_TYPE))
{
// парсим атрибуты
std::string type, name;
root->findAttribute("type", type);
root->findAttribute("name", name);
if (name.empty())
continue;
MapResource::iterator item = mResources.find(name);
if (item != mResources.end())
{
MYGUI_LOG(Warning, "dublicate resource name '" << name << "'");
// ресурсами могут пользоваться
mRemovedResoures.push_back((*item).second);
mResources.erase(item);
}
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);
mResources[name] = resource;
}
}
开发者ID:alexis-,项目名称:iwe,代码行数:39,代码来源:MyGUI_ResourceManager.cpp
示例17: deserialization
void ResourceTrueTypeFont::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")
setSource(value);
else if (key == "Size")
setSize(utility::parseFloat(value));
else if (key == "Resolution")
setResolution(utility::parseUInt(value));
else if (key == "Antialias")
setAntialias(utility::parseBool(value));
else if (key == "TabWidth")
setTabWidth(utility::parseFloat(value));
else if (key == "OffsetHeight")
setOffsetHeight(utility::parseInt(value));
else if (key == "SubstituteCode")
setSubstituteCode(utility::parseInt(value));
else if (key == "Distance")
setDistance(utility::parseInt(value));
else if (key == "Hinting")
setHinting(value);
else if (key == "SpaceWidth")
{
mSpaceWidth = utility::parseFloat(value);
MYGUI_LOG(Warning, _node->findAttribute("type") << ": Property '" << key << "' in font '" << _node->findAttribute("name") << "' is deprecated; remove it to use automatic calculation.");
}
else if (key == "CursorWidth")
{
MYGUI_LOG(Warning, _node->findAttribute("type") << ": Property '" << key << "' in font '" << _node->findAttribute("name") << "' is deprecated; value ignored.");
}
}
else if (node->getName() == "Codes")
{
// Range of inclusions.
xml::ElementEnumerator range = node->getElementEnumerator();
while (range.next("Code"))
{
std::string range_value;
if (range->findAttribute("range", range_value))
{
std::vector<std::string> parse_range = utility::split(range_value);
if (!parse_range.empty())
{
Char first = utility::parseUInt(parse_range[0]);
Char last = parse_range.size() > 1 ? utility::parseUInt(parse_range[1]) : first;
addCodePointRange(first, last);
}
}
}
// If no code points have been included, include the Unicode Basic Multilingual Plane by default before processing
// any exclusions.
if (mCharMap.empty())
addCodePointRange(0, 0xFFFF);
// Range of exclusions.
range = node->getElementEnumerator();
while (range.next("Code"))
{
std::string range_value;
if (range->findAttribute("hide", range_value))
{
std::vector<std::string> parse_range = utility::split(range_value);
if (!parse_range.empty())
{
Char first = utility::parseUInt(parse_range[0]);
Char last = parse_range.size() > 1 ? utility::parseUInt(parse_range[1]) : first;
removeCodePointRange(first, last);
}
}
}
}
}
initialise();
}
开发者ID:MyGUI,项目名称:mygui,代码行数:84,代码来源:MyGUI_ResourceTrueTypeFont.cpp
示例18: deserialization
void ResourceSkin::deserialization(xml::ElementPtr _node, Version _version)
{
Base::deserialization(_node, _version);
std::string stateCategory = SubWidgetManager::getInstance().getStateCategoryName();
// парсим атрибуты скина
std::string name, texture, tmp;
IntSize size;
_node->findAttribute("name", name);
_node->findAttribute("texture", texture);
if (_node->findAttribute("size", tmp)) size = IntSize::parse(tmp);
LanguageManager& localizator = LanguageManager::getInstance();
// вспомогательный класс для биндинга сабскинов
SubWidgetBinding bind;
// поддержка замены тегов в скинах
if (_version >= Version(1, 1))
{
texture = localizator.replaceTags(texture);
}
setInfo(size, texture);
// проверяем маску
if (_node->findAttribute("mask", tmp))
addProperty("MaskPick", tmp);
// берем детей и крутимся, цикл с саб скинами
xml::ElementEnumerator basis = _node->getElementEnumerator();
while (basis.next())
{
if (basis->getName() == "Property")
{
// загружаем свойства
std::string key, value;
if (!basis->findAttribute("key", key))
continue;
if (!basis->findAttribute("value", value))
continue;
// поддержка замены тегов в скинах
if (_version >= Version(1, 1))
{
value = localizator.replaceTags(value);
}
// добавляем свойство
addProperty(key, value);
}
else if (basis->getName() == "Child")
{
ChildSkinInfo child(
basis->findAttribute("type"),
WidgetStyle::parse(basis->findAttribute("style")),
basis->findAttribute("skin"),
IntCoord::parse(basis->findAttribute("offset")),
Align::parse(basis->findAttribute("align")),
basis->findAttribute("layer"),
basis->findAttribute("name")
);
xml::ElementEnumerator child_params = basis->getElementEnumerator();
while (child_params.next("Property"))
child.addParam(child_params->findAttribute("key"), child_params->findAttribute("value"));
addChild(child);
//continue;
}
else if (basis->getName() == "BasisSkin")
{
// парсим атрибуты
std::string basisSkinType, tmp_str;
IntCoord offset;
Align align = Align::Default;
basis->findAttribute("type", basisSkinType);
if (basis->findAttribute("offset", tmp_str))
offset = IntCoord::parse(tmp_str);
if (basis->findAttribute("align", tmp_str))
align = Align::parse(tmp_str);
bind.create(offset, align, basisSkinType);
// берем детей и крутимся, цикл со стейтами
xml::ElementEnumerator state = basis->getElementEnumerator();
// проверяем на новый формат стейтов
bool new_format = false;
// если версия меньше 1.0 то переименовываем стейты
if (_version < Version(1, 0))
{
while (state.next())
{
if (state->getName() == "State")
{
const std::string& name_state = state->findAttribute("name");
if ((name_state == "normal_checked") || (state->findAttribute("name") == "normal_check"))
{
//.........这里部分代码省略.........
开发者ID:dayongxie,项目名称:MyGUI,代码行数:101,代码来源:MyGUI_ResourceSkin.cpp
示例19: 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);
}
}
loadTexture();
if (mTexture != nullptr)
{
int textureWidth = mTexture->getWidth();
int textureHeight = mTexture->getHeight();
node = _node->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Codes")
{
xml::ElementEnumerator element = node->getElementEnumerator();
while (element.next("Code"))
{
std::string value;
// описане глифов
if (element->findAttribute("index", value))
{
Char id = 0;
if (value == "cursor")
id = static_cast<Char>(FontCodeType::Cursor);
else if (value == "selected")
id = static_cast<Char>(FontCodeType::Selected);
else if (value == "selected_back")
id = static_cast<Char>(FontCodeType::SelectedBack);
else if (value == "substitute")
id = static_cast<Char>(FontCodeType::NotDefined);
else
id = utility::parseUInt(value);
float advance(utility::parseValue<float>(element->findAttribute("advance")));
FloatPoint bearing(utility::parseValue<FloatPoint>(element->findAttribute("bearing")));
// texture coordinates
FloatCoord coord(utility::parseValue<FloatCoord>(element->findAttribute("coord")));
// glyph size, default to texture coordinate size
std::string sizeString;
FloatSize size(coord.width, coord.height);
if (element->findAttribute("size", sizeString))
{
size = utility::parseValue<FloatSize>(sizeString);
}
if (advance == 0.0f)
advance = size.width;
GlyphInfo& glyphInfo = mCharMap.insert(CharMap::value_type(id, GlyphInfo(
id,
size.width,
size.height,
advance,
bearing.left,
bearing.top,
FloatRect(
coord.left / textureWidth,
coord.top / textureHeight,
coord.right() / textureWidth,
coord.bottom() / textureHeight)
))).first->second;
if (id == FontCodeType::NotDefined)
mSubstituteGlyphInfo = &glyphInfo;
}
}
}
}
}
}
开发者ID:MyGUI,项目名称:mygui,代码行数:86,代码来源:MyGUI_ResourceManualFont.cpp
示例20: while
void FontManager::_load(xml::ElementPtr _node, const std::string& _file, Version _version)
{
xml::ElementEnumerator font = _node->getElementEnumerator();
while (font.next())
{
if (font->getName() == XML_TYPE)
{
std::string name;
if (!font->findAttribute("name", name)) continue;
std::string type;
if (type.empty())
{
if (font->findAttribute("resolution").empty()) type = "ResourceManualFont";
else type = "ResourceTrueTypeFont";
}
xml::Document doc;
xml::ElementPtr root = doc.createRoot("MyGUI");
xml::ElementPtr node = root->createChild("Resource");
node->addAttribute("type", type);
node->addAttribute("name", name);
std::string tmp;
if (font->findAttribute("source", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "Source");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("size", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "Size");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("resolution", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "Resolution");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("antialias_colour", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "Antialias");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("space_width", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "SpaceWidth");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("tab_width", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "TabWidth");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("cursor_width", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "CursorWidth");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("distance", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "Distance");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("offset_height", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "OffsetHeight");
prop->addAttribute("value", tmp);
}
if (font->findAttribute("default_height", tmp))
{
xml::ElementPtr prop = node->createChild("Property");
prop->addAttribute("key", "DefaultHeight");
prop->addAttribute("value", tmp);
}
xml::ElementPtr codes = node->createChild("Codes");
xml::ElementEnumerator codeold = font->getElementEnumerator();
while (codeold.next("Code"))
{
xml::ElementPtr codenew = codes->createChild("Code");
//.........这里部分代码省略.........
开发者ID:siangzhang,项目名称:starworld,代码行数:101,代码来源:MyGUI_FontManager.cpp
注:本文中的xml::ElementPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论