本文整理汇总了C++中mygui::xml::ElementPtr::findAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementPtr::findAttribute方法的具体用法?C++ ElementPtr::findAttribute怎么用?C++ ElementPtr::findAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::xml::ElementPtr
的用法示例。
在下文中一共展示了ElementPtr::findAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialization
void EditTextStateInfo::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) {
mShift = MyGUI::utility::parseBool(_node->findAttribute("shift"));
std::string colour = _node->findAttribute("colour");
if (_version >= MyGUI::Version(1, 1))
{
colour = MyGUI::LanguageManager::getInstance().replaceTags(colour);
}
mColour = MyGUI::Colour::parse(colour);
}
示例2: loadJoint
void Framework::loadJoint( MyGUI::xml::ElementPtr node,RigidPtr parent )
{
ObjectFactory& factory = ObjectFactory::getSingleton();
string typeName = node->findAttribute("type");
JointPtr jpt = boost::dynamic_pointer_cast<Joint>(factory.createObject(typeName));
if(jpt)
{
if( parent )
{
jpt->mRigid[0] = parent;
}
addJoint(jpt);
jpt->load(node);
MyGUI::xml::ElementEnumerator ce = node->getElementEnumerator();
while(ce.next())
{
MyGUI::xml::ElementPtr child = ce.current();
if( child->getName() == "rigid" )
{
loadRigid(child, jpt);
}
break;
}
}
else
{
WARNING_LOG("Factory can't make "<<typeName);
}
}
示例3: isMetaSolution
bool EditorState::isMetaSolution(const MyGUI::UString& _fileName)
{
MyGUI::xml::Document doc;
if (!doc.open(_fileName))
{
return false;
}
MyGUI::xml::ElementPtr root = doc.getRoot();
if (!root || (root->getName() != "MyGUI"))
{
return false;
}
std::string type;
if (root->findAttribute("type", type))
{
if (type == "MetaSolution")
{
return true;
}
}
return false;
}
示例4: load
void Rigid::load( MyGUI::xml::ElementPtr node )
{
string ms;
VisualObject::load(node);
if(node->findAttribute("mass", ms))
{
mMassDensity = toValue(ms,(dReal)1);
}
_init();
_visual2physic();
}
示例5: load
void Framework::load( MyGUI::xml::ElementPtr node )
{
removeAllJoint();
mName = node->findAttribute("name");
MyGUI::xml::ElementEnumerator e=node->getElementEnumerator();
while(e.next())
{
MyGUI::xml::ElementPtr node = e.current();
if( node->getName() == "body" )
{
loadRigid(node, JointPtr());
}
break;
}
}
示例6: convertProjectName
MyGUI::UString EditorState::convertProjectName(const MyGUI::UString& _fileName)
{
size_t pos = mFileName.find_last_of("\\/");
MyGUI::UString shortName = pos == MyGUI::UString::npos ? mFileName : mFileName.substr(pos + 1);
addUserTag("ResourceName", shortName);
size_t index = _fileName.find("|");
if (index == MyGUI::UString::npos)
return _fileName;
MyGUI::UString fileName = _fileName.substr(0, index);
MyGUI::UString itemIndexName = _fileName.substr(index + 1);
size_t itemIndex = MyGUI::utility::parseValue<size_t>(itemIndexName);
MyGUI::xml::Document doc;
if (!doc.open(fileName))
return _fileName;
MyGUI::xml::ElementPtr root = doc.getRoot();
if ((nullptr == root) || (root->getName() != "MyGUI"))
return _fileName;
if (root->findAttribute("type") == "Resource")
{
// берем детей и крутимся
MyGUI::xml::ElementEnumerator element = root->getElementEnumerator();
while (element.next("Resource"))
{
if (element->findAttribute("type") == "ResourceLayout")
{
if (itemIndex == 0)
{
// поменять на теги
std::string resourceName = element->findAttribute("name");
addUserTag("ResourceName", resourceName);
return MyGUI::utility::toString(fileName, " [", resourceName, "]");
}
else
{
itemIndex --;
}
}
}
}
return _fileName;
}
示例7: loadSettings
void SettingsManager::loadSettings(const MyGUI::UString& _fileName, bool _internal)
{
std::string _instance = "Editor";
MyGUI::xml::Document doc;
if (_internal)
{
MyGUI::DataStreamHolder data = MyGUI::DataManager::getInstance().getData(_fileName);
if (data.getData() != nullptr)
{
if (!doc.open(data.getData()))
{
MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError());
return;
}
}
}
else
{
if (!doc.open(_fileName))
{
MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError());
return;
}
}
MyGUI::xml::ElementPtr root = doc.getRoot();
if (!root || (root->getName() != "MyGUI"))
{
MYGUI_LOGGING(LogSection, Error, _instance << " : '" << _fileName << "', tag 'MyGUI' not found");
return;
}
std::string type;
if (root->findAttribute("type", type))
{
if (type == "Settings")
{
// берем детей и крутимся
MyGUI::xml::ElementEnumerator field = root->getElementEnumerator();
while (field.next())
loadSector(field.current());
}
}
}
示例8: deserialization
void MaskSetSubSkinState::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) {
std::string texture = _node->getParent()->findAttribute("texture");
if (texture.empty()) {
texture = _node->getParent()->getParent()->findAttribute("texture");
}
// tags replacement support for Skins
if (_version >= MyGUI::Version(1, 1))
{
texture = MyGUI::LanguageManager::getInstance().replaceTags(texture);
}
const MyGUI::IntSize& size = MyGUI::texture_utility::getTextureSize(texture);
m_texture = MyGUI::RenderManager::getInstance().getTexture(texture);
const MyGUI::IntCoord& coord = MyGUI::IntCoord::parse(_node->findAttribute("offset"));
setRect(MyGUI::CoordConverter::convertTextureCoord(coord, size));
}
示例9: loadSettings
//===================================================================================
void EditorState::loadSettings(const MyGUI::UString& _fileName, bool _internal)
{
std::string _instance = "Editor";
MyGUI::xml::Document doc;
if (_internal)
{
MyGUI::IDataStream* data = MyGUI::DataManager::getInstance().getData(_fileName);
if (data)
{
PtrHolder<MyGUI::IDataStream> holder = PtrHolder<MyGUI::IDataStream>(data);
if (!doc.open(data))
{
MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError());
return;
}
}
}
else
{
if (!doc.open(_fileName))
{
MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError());
return;
}
}
MyGUI::xml::ElementPtr root = doc.getRoot();
if (!root || (root->getName() != "MyGUI"))
{
MYGUI_LOGGING(LogSection, Error, _instance << " : '" << _fileName << "', tag 'MyGUI' not found");
return;
}
std::string type;
if (root->findAttribute("type", type))
{
if (type == "Settings")
{
// берем детей и крутимс¤
MyGUI::xml::ElementEnumerator field = root->getElementEnumerator();
while (field.next())
{
if (field->getName() == "PropertiesPanelView") mPropertiesPanelView->load(field);
else if (field->getName() == "SettingsWindow") mSettingsWindow->load(field);
else if (field->getName() == "WidgetsWindow") mWidgetsWindow->load(field);
else if (field->getName() == "MetaSolutionWindow")
{
if (isNeedSolutionLoad(field))
{
clearWidgetWindow();
mMetaSolutionWindow->load(field);
}
}
else if (field->getName() == "RecentFile")
{
std::string name;
if (!field->findAttribute("name", name)) continue;
recentFiles.push_back(name);
}
else if (field->getName() == "AdditionalPath")
{
std::string name;
if (!field->findAttribute("name", name)) continue;
additionalPaths.push_back(name);
}
}
}
}
}