本文整理汇总了C++中mygui::xml::ElementEnumerator::current方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementEnumerator::current方法的具体用法?C++ ElementEnumerator::current怎么用?C++ ElementEnumerator::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::xml::ElementEnumerator
的用法示例。
在下文中一共展示了ElementEnumerator::current方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: deserialization
void SkinItem::deserialization(MyGUI::xml::Element* _node, MyGUI::Version _version)
{
mName = _node->findAttribute("name");
mStates.destroyAllChilds();
mSeparators.destroyAllChilds();
mRegions.destroyAllChilds();
MyGUI::xml::ElementEnumerator nodes = _node->getElementEnumerator();
while (nodes.next())
{
MyGUI::xml::Element* node = nodes.current();
if (node->getName() == "PropertySet")
{
mPropertySet->deserialization(node, _version);
}
else if (node->getName() == "StateItem")
{
StateItem* item = mStates.createChild();
item->deserialization(node, _version);
}
else if (node->getName() == "SeparatorItem")
{
SeparatorItem* item = mSeparators.createChild();
item->deserialization(node, _version);
}
else if (node->getName() == "RegionItem")
{
RegionItem* item = mRegions.createChild();
item->deserialization(node, _version);
}
}
}
示例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: load
void EditorState::load()
{
SkinManager::getInstance().clear();
MyGUI::xml::Document doc;
if (doc.open(mFileName))
{
bool result = false;
MyGUI::xml::Element* root = doc.getRoot();
if (root->getName() == "Root")
{
MyGUI::xml::ElementEnumerator nodes = root->getElementEnumerator();
while (nodes.next("SkinManager"))
{
SkinManager::getInstance().deserialization(nodes.current(), MyGUI::Version());
result = true;
if (mFileName != mDefaultFileName)
RecentFilesManager::getInstance().addRecentFile(mFileName);
break;
}
}
if (!result)
{
/*MyGUI::Message* message =*/ MessageBoxManager::getInstance().create(
replaceTags("Error"),
replaceTags("MessageIncorrectFileFormat"),
MyGUI::MessageBoxStyle::IconError
| MyGUI::MessageBoxStyle::Yes);
mFileName = mDefaultFileName;
addUserTag("CurrentFileName", mFileName);
updateCaption();
}
}
else
{
/*MyGUI::Message* message =*/ MessageBoxManager::getInstance().create(
replaceTags("Error"),
doc.getLastError(),
MyGUI::MessageBoxStyle::IconError
| MyGUI::MessageBoxStyle::Yes);
}
ActionManager::getInstance().setChanges(false);
}
示例5: 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());
}
}
}
示例6: exportSkin
void ExportManager::exportSkin(const MyGUI::UString& _fileName)
{
MyGUI::xml::Document doc;
MyGUI::xml::Element* root = doc.createRoot("Root");
SkinManager::getInstance().serialization(root, MyGUI::Version());
MyGUI::xml::Document docOut;
docOut.createDeclaration();
MyGUI::xml::Element* rootOut = docOut.createRoot("MyGUI");
rootOut->addAttribute("type", "Resource");
rootOut->addAttribute("version", "1.1");
MyGUI::xml::ElementEnumerator skins = root->getElementEnumerator();
while (skins.next())
convertSkin(skins.current(), rootOut->createChild("Resource"));
docOut.save(_fileName);
}
示例7: loadFromFile
void DemoKeeper::loadFromFile(const std::string& _filename)
{
MyGUI::xml::Document doc;
if (!doc.open(_filename))
return;
MyGUI::xml::ElementPtr root = doc.getRoot();
if (root == nullptr || root->getName() != "AnimationGraph")
return;
MyGUI::xml::ElementEnumerator node = root->getElementEnumerator();
while (node.next())
{
if (node->getName() == "Node")
{
BaseAnimationNode* anim_node = createNode(node->findAttribute("type"), node->findAttribute("name"));
anim_node->deserialization(node.current());
}
else if (node->getName() == "Connections")
{
MyGUI::xml::ElementEnumerator conn = node->getElementEnumerator();
BaseAnimationNode* anim_node = getNodeByName(node.current()->findAttribute("node"));
if (anim_node)
{
while (conn.next("Connection"))
{
BaseAnimationNode* anim_node2 = getNodeByName(conn.current()->findAttribute("node"));
if (anim_node2)
{
//соединить точки в ноде
const std::string& from_point = conn.current()->findAttribute("from");
const std::string& to_point = conn.current()->findAttribute("to");
wraps::BaseGraphConnection* from_conn = anim_node->getConnectionByName(from_point, "EventOut");
if (!from_conn) from_conn = anim_node->getConnectionByName(from_point, "PositionOut");
if (!from_conn) from_conn = anim_node->getConnectionByName(from_point, "WeightOut");
wraps::BaseGraphConnection* to_conn = anim_node2->getConnectionByName(to_point, "EventIn");
if (!to_conn) to_conn = anim_node2->getConnectionByName(to_point, "PositionIn");
if (!to_conn) to_conn = anim_node2->getConnectionByName(to_point, "WeightIn");
if (from_conn && to_conn)
{
from_conn->addConnectionPoint(to_conn);
connectPoints(anim_node, anim_node2, from_point, to_point);
}
}
}
}
}
else if (node->getName() == "EditorData")
{
MyGUI::xml::ElementEnumerator item_data = node->getElementEnumerator();
while (item_data.next("Node"))
{
BaseAnimationNode* anim_node = getNodeByName(item_data.current()->findAttribute("name"));
if (anim_node)
{
anim_node->setCoord(MyGUI::IntCoord::parse(item_data.current()->findAttribute("coord")));
}
}
}
}
}
示例8: convertSkin
void ExportManager::convertSkin(MyGUI::xml::Element* _from, MyGUI::xml::Element* _to)
{
_to->addAttribute("type", "ResourceSkin");
_to->addAttribute("name", _from->findAttribute("name"));
MyGUI::xml::ElementEnumerator nodes = _from->getElementEnumerator();
while (nodes.next())
{
MyGUI::UString coordValue;
MyGUI::UString textureValue;
MyGUI::xml::Element* node = nodes.current();
if (node->getName() == "PropertySet")
{
MyGUI::xml::ElementEnumerator propertyNodes = node->getElementEnumerator();
while (propertyNodes.next("Property"))
{
MyGUI::xml::Element* propertyNode = propertyNodes.current();
std::string name;
if (propertyNode->findAttribute("name", name))
{
if (name == "Coord")
{
MyGUI::IntCoord coord = MyGUI::IntCoord::parse(propertyNode->getContent());
coordValue = coord.size().print();
}
else if (name == "Texture")
{
textureValue = propertyNode->getContent();
}
}
}
_to->addAttribute("size", coordValue);
_to->addAttribute("texture", textureValue);
break;
}
else if (node->getName() == "RegionItem")
{
bool regionVisible = true;
MyGUI::xml::ElementEnumerator regionNodes = node->getElementEnumerator();
while (regionNodes.next("PropertySet"))
{
MyGUI::xml::ElementEnumerator propertyNodes = regionNodes->getElementEnumerator();
while (propertyNodes.next("Property"))
{
MyGUI::xml::Element* propertyNode = propertyNodes.current();
std::string name;
if (propertyNode->findAttribute("name", name))
{
if (name == "Visible")
{
if (propertyNode->getContent() != "True")
regionVisible = false;
}
else if (name == "Enabled")
{
if (propertyNode->getContent() != "True")
regionVisible = false;
}
}
}
break;
}
if (!regionVisible)
continue;
MyGUI::xml::Element* region = _to->createChild("BasisSkin");
MyGUI::IntCoord regionCoord;
MyGUI::UString regionTypeValue;
MyGUI::UString regionOffsetValue;
MyGUI::UString alignValue;
regionNodes = node->getElementEnumerator();
while (regionNodes.next("PropertySet"))
{
MyGUI::xml::ElementEnumerator regionPropertyNode = regionNodes->getElementEnumerator();
while (regionPropertyNode.next("Property"))
{
std::string name;
if (regionPropertyNode->findAttribute("name", name))
{
if (name == "RegionType")
{
regionTypeValue = regionPropertyNode->getContent();
}
else if (name == "Position")
{
regionCoord = MyGUI::IntCoord::parse(regionPropertyNode->getContent());
regionOffsetValue = regionCoord.print();
}
else if (name == "Align")
{
alignValue = regionPropertyNode->getContent();
//.........这里部分代码省略.........