本文整理汇总了C++中mygui::xml::ElementPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ElementPtr类的具体用法?C++ ElementPtr怎么用?C++ ElementPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ElementPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupResources
void BaseManager::setupResources()
{
MyGUI::xml::Document doc;
if (!doc.open(std::string("resources.xml")))
doc.getLastError();
MyGUI::xml::ElementPtr root = doc.getRoot();
if (root == nullptr || root->getName() != "Paths")
return;
MyGUI::xml::ElementEnumerator node = root->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Path")
{
if (node->findAttribute("root") != "")
{
bool root = MyGUI::utility::parseBool(node->findAttribute("root"));
if (root)
mRootMedia = node->getContent();
}
addResourceLocation(node->getContent(), false);
}
}
addResourceLocation(getRootMedia() + "/Common/Base");
}
示例2: setupResources
void MYGUIManager::setupResources()
{
MyGUI::xml::Document doc;
if ( !_platform || !doc.open(_resourcePathFile) ) doc.getLastError();
MyGUI::xml::ElementPtr root = doc.getRoot();
if ( root==nullptr || root->getName()!="Paths" ) return;
MyGUI::xml::ElementEnumerator node = root->getElementEnumerator();
while ( node.next() )
{
if ( node->getName()=="Path" )
{
bool root = false, recursive = false;
if (!node->findAttribute("root").empty())
{
root = MyGUI::utility::parseBool( node->findAttribute("root") );
if ( root ) _rootMedia = node->getContent();
}
if (!node->findAttribute("recursive").empty())
{
recursive = MyGUI::utility::parseBool(node->findAttribute("recursive"));
}
_platform->getDataManagerPtr()->addResourceLocation(node->getContent(), recursive);
}
}
}
示例3: loadRigid
void Framework::loadRigid( MyGUI::xml::ElementPtr node,JointPtr parent )
{
ObjectFactory& factory = ObjectFactory::getSingleton();
RigidPtr rgp = boost::dynamic_pointer_cast<Rigid>(factory.createObject("Rigid"));
if(rgp)
{
rgp->load(node);
if( parent )
{
parent->mRigid[1] = rgp;
parent->linkRigid(parent->mRigid[0], parent->mRigid[1]);
}
MyGUI::xml::ElementEnumerator ce = node->getElementEnumerator();
while(ce.next())
{
MyGUI::xml::ElementPtr child = ce.current();
if( child->getName() == "joint" )
{
loadJoint( child,rgp );
}
}
}
else
{
WARNING_LOG("Factory can't make Rigid object!");
}
}
示例4: 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;
}
示例5: 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);
}
}
示例6: Setup
//--------------------------------------------------------------------------------
void System::Setup()
{
MyGUI::xml::Document doc;
if (!doc.open(std::string("resources.xml")))
doc.getLastError();
MyGUI::xml::ElementPtr root = doc.getRoot();
if (root == nullptr || root->getName() != "Paths")
return;
MyGUI::xml::ElementEnumerator node = root->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Path")
{
bool root = false;
if (node->findAttribute("root") != "")
{
root = MyGUI::utility::parseBool(node->findAttribute("root"));
if (root) mRootMedia = node->getContent();
}
mPlatform->getDataManagerPtr()->addResourceLocation(node->getContent(), false);
}
}
}
示例7: _load
void HotkeyManager::_load( MyGUI::xml::ElementPtr root,const string xml )
{
if( root == nullptr || root->getName() != "HKS" )
{
WARNING_LOG("bad Hotkey config file "<<xml);
return;
}
MyGUI::xml::ElementEnumerator node = root->getElementEnumerator();
while( node.next() )
{
if( node->getName() == "hotkey" )
{
hotkey hk;
if( !node->findAttribute("name",hk.mName) )
{
WARNING_LOG("Hotkey config file "<<xml<<" invalid hotkey node");
continue;
}
node->findAttribute("caption",hk.mCaption);
node->findAttribute("tip",hk.mTip);
node->findAttribute("key",hk.mHotkey);
hk.mSHotkey = getStandardHotkeyName(hk.mHotkey);
mHotkeys.push_back( hk );
//设置对应Widget的User string,便于其显示出正常的热键
setWidgetHotkey( hk.mName,hk.mHotkey );
}
}
}
示例8: saveJoint
/* 一组递归函数,用来保存
*/
void Framework::saveJoint(MyGUI::xml::ElementPtr node,Joint* joint,RigidPtr other)
{
node->addAttribute("type", joint->getTypeName());
joint->save(node);
MyGUI::xml::ElementPtr child = node->createChild("rigid");
RigidPtr rgp = joint->other(other);
if( rgp )
saveRigid(child,rgp,joint);
}
示例9: 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);
}
示例10: save
void PropertiesPanelView::save(MyGUI::xml::ElementPtr root)
{
root = root->createChild("PropertiesPanelView");
MyGUI::xml::ElementPtr nodeProp;
for (VectorPanel::iterator iter = mPanels.begin(); iter != mPanels.end(); ++iter)
{
nodeProp = root->createChild("Property");
nodeProp->addAttribute("key", MyGUI::utility::toString("Panel","Minimized"));
nodeProp->addAttribute("value", (*iter)->getPanelCell()->isMinimized());
}
}
示例11: 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;
}
}
示例12: loadValues
void WidgetTypes::loadValues(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version)
{
MyGUI::xml::ElementEnumerator widgets = _node->getElementEnumerator();
while (widgets.next("Value"))
{
std::string name = widgets->findAttribute("name");
PossibleValue* possible_value = getPossibleValue(name);
// тип мерджа переменных
std::string merge = widgets->findAttribute("merge");
// дополняем своими данными, по дефолту
if (merge == "add")
{
}
// удаляем и добавляем свои
else if (merge == "replace")
{
possible_value->values.clear();
}
// берем детей и крутимся
MyGUI::xml::ElementEnumerator field = widgets->getElementEnumerator();
while (field.next())
{
std::string key, value;
if (field->getName() == "Property")
{
if (!field->findAttribute("key", key))
continue;
possible_value->values.push_back(MyGUI::LanguageManager::getInstance().replaceTags(key));
}
}
}
}
示例13: 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;
}
示例14: bindElement
/*
注意ElementPtr 就是 Element*
setNotifyDelete()在析构的时候被调用
*/
static void bindElement(lua_State*L,const MyGUI::xml::ElementPtr& obj)
{
if( obj )
{
obj->setNotifyDelete( notifyDelete );
lua_bind(L,"xml.Element",obj);
}
}
示例15: exportData
bool FontExportSerializer::exportData(const MyGUI::UString& _folderName, const MyGUI::UString& _fileName)
{
MyGUI::xml::Document document;
document.createDeclaration();
MyGUI::xml::ElementPtr root = document.createRoot("MyGUI");
root->addAttribute("type", "Resource");
root->addAttribute("version", "1.1");
DataPtr data = DataManager::getInstance().getRoot();
for (Data::VectorData::const_iterator child = data->getChilds().begin(); child != data->getChilds().end(); child ++)
{
generateFont((*child));
generateFontManualXml(root, _folderName, (*child));
}
return document.save(common::concatenatePath(_folderName, _fileName));
}