• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ xml::Document类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中mygui::xml::Document的典型用法代码示例。如果您正苦于以下问题:C++ Document类的具体用法?C++ Document怎么用?C++ Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Document类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
	}
开发者ID:chena1982,项目名称:mygui,代码行数:28,代码来源:BaseManager.cpp


示例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);
        }
    }
}
开发者ID:acmepjz,项目名称:turning-polyhedron-reloaded,代码行数:27,代码来源:MYGUIManager.cpp


示例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;
}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:25,代码来源:EditorState.cpp


示例4: 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);
				}
			}
		}
开发者ID:679565,项目名称:SkyrimOnline,代码行数:28,代码来源:System.cpp


示例5: generateSkin

	void TestWindow::generateSkin()
	{
		if (MyGUI::ResourceManager::getInstance().isExist(mSkinName))
			MyGUI::ResourceManager::getInstance().removeByName(mSkinName);

		pugi::xml_document doc;
		pugi::xml_node decl = doc.prepend_child(pugi::node_declaration);
		decl.append_attribute("version") = "1.0";
		decl.append_attribute("encoding") = "UTF-8";

		pugi::xml_node root = doc.append_child("MyGUI");
		root.append_attribute("type").set_value("Resource");
		root.append_attribute("version").set_value("1.1");

		SkinExportSerializer* serializer = new SkinExportSerializer();
		serializer->writeSkin(root, mSkinItem);
		delete serializer;

		root.select_single_node("Resource/@name").attribute().set_value(mSkinName.c_str());

		bool result = doc.save_file(mTestSkinFileName.c_str(), "\t", (pugi::format_indent | pugi::format_write_bom | pugi::format_win_new_line) & (~pugi::format_space_before_slash));

		MyGUI::xml::Document docLoad;
		docLoad.open(mTestSkinFileName);
		MyGUI::xml::Element* resourceNode = docLoad.getRoot();

		MyGUI::ResourceManager::getInstance().loadFromXmlNode(resourceNode, "", MyGUI::Version(1, 1, 0));
	}
开发者ID:chhawk,项目名称:MyGUI,代码行数:28,代码来源:TestWindow.cpp


示例6: saveFontTTFXml

	void FontPanel::saveFontTTFXml(const std::string& _fontName, const std::string& _fileName)
	{
		MyGUI::xml::Document document;
		document.createDeclaration();
		MyGUI::xml::ElementPtr root = document.createRoot("MyGUI");
		generateFontTTFXml(root, _fontName);

		if (document.save(_fileName))
			MyGUI::Message::createMessageBox("Message", "success", _fileName, MyGUI::MessageBoxStyle::Ok | MyGUI::MessageBoxStyle::IconInfo);
		else
			MyGUI::Message::createMessageBox("Message", "error", document.getLastError(), MyGUI::MessageBoxStyle::Ok | MyGUI::MessageBoxStyle::IconError);
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:12,代码来源:FontPanel.cpp


示例7: 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);
	}
开发者ID:siangzhang,项目名称:starworld,代码行数:49,代码来源:EditorState.cpp


示例8: save

	void EditorState::save()
	{
		MyGUI::xml::Document doc;
		doc.createDeclaration();
		MyGUI::xml::Element* root = doc.createRoot("Root");
		MyGUI::xml::Element* skins = root->createChild("SkinManager");

		SkinManager::getInstance().serialization(skins, MyGUI::Version());

		doc.save(mFileName);

		if (mFileName != mDefaultFileName)
			RecentFilesManager::getInstance().addRecentFile(mFileName);

		ActionManager::getInstance().setChanges(false);
	}
开发者ID:siangzhang,项目名称:starworld,代码行数:16,代码来源:EditorState.cpp


示例9: notifyMouseButtonClick

	void FontPanel::notifyMouseButtonClick(MyGUI::Widget* _widget)
	{
		// шрифтов нету
		if (mComboFont->getOnlyText().empty())
			return;
		if (mEditSaveFileName->getOnlyText().empty() && _widget == mButtonSave)
			return;

		if (_widget == mButtonSave)
		{
			std::string textureName = mEditSaveFileName->getOnlyText() + ".png";
			saveTexture(mFontName, textureName);

			std::string fontName = MyGUI::utility::toString(mEditSaveFileName->getOnlyText(), ".ttf.", mFontHeight);
			std::string fileName = mEditSaveFileName->getOnlyText() + ".ttf.xml";
			saveFontTTFXml(fontName, fileName);

			fontName = MyGUI::utility::toString(mEditSaveFileName->getOnlyText(), ".manual.", mFontHeight);
			fileName = mEditSaveFileName->getOnlyText() + ".manual.xml";
			saveFontManualXml(fontName, textureName, fileName);
		}
		else if (_widget == mButtonGenerate)
		{
			MyGUI::ResourceManager& manager = MyGUI::ResourceManager::getInstance();
			if (manager.isExist(mFontName))
			{
				manager.removeByName(mFontName);
			}

			MyGUI::xml::Document document;
			document.createDeclaration();
			MyGUI::xml::ElementPtr root = document.createRoot("MyGUI");
			generateFontTTFXml(root, mFontName);

			MyGUI::ResourceManager::getInstance().loadFromXmlNode(root, "", MyGUI::Version());
			MyGUI::IResource* resource = manager.getByName(mFontName, false);
			MYGUI_ASSERT(resource != nullptr, "Could not find font '" << mFontName << "'");
			MyGUI::IFont* font = resource->castType<MyGUI::IFont>();

			// вывод реального размера шрифта
			mFontHeight = font->getDefaultHeight();
			mTextPix->setCaption(MyGUI::utility::toString("Height of a font is ", mFontHeight, " pixels"));

			mFontView->setFontName(mFontName);
			mTextureView->setFontName(mFontName);
		}
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:47,代码来源:FontPanel.cpp


示例10: 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;
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:47,代码来源:EditorState.cpp


示例11: notifyMouseButtonClick

	void FontPanel::notifyMouseButtonClick(MyGUI::Widget* _widget)
	{
		// шрифто?нету
		if (mComboFont->getOnlyText().empty()) return;
		if (mEditSaveFileName->getOnlyText().empty() && _widget == mButtonSave) return;

		MyGUI::xml::Document document;
		document.createDeclaration();
		MyGUI::xml::ElementPtr root = document.createRoot("MyGUI");
		generateFontTTFXml(root);

		if (_widget == mButtonSave)
		{
			if (!document.save(mEditSaveFileName->getOnlyText() + ".xml"))
			{
				/*MyGUI::Message* message =*/ MyGUI::Message::createMessageBox("Message", "error", document.getLastError(), MyGUI::MessageBoxStyle::Ok | MyGUI::MessageBoxStyle::IconError);
			}
			else
			{
				/*MyGUI::Message* message =*/ MyGUI::Message::createMessageBox("Message", "success", mEditSaveFileName->getOnlyText() + ".xml", MyGUI::MessageBoxStyle::Ok | MyGUI::MessageBoxStyle::IconInfo);
			}

			MyGUI::IFont* font = MyGUI::FontManager::getInstance().getByName(mFontName);
			MyGUI::ITexture* texture = font->getTextureFont();
			texture->saveToFile(mEditSaveFileName->getOnlyText() + ".png");
		}
		else if (_widget == mButtonGenerate)
		{
			MyGUI::ResourceManager& manager = MyGUI::ResourceManager::getInstance();
			if (manager.isExist(mFontName))
			{
				manager.removeByName(mFontName);
			}

			MyGUI::ResourceManager::getInstance().loadFromXmlNode(root, "", MyGUI::Version());
			MyGUI::IResource* resource = manager.getByName(mFontName, false);
			MYGUI_ASSERT(resource != nullptr, "Could not find font '" << mFontName << "'");
			MyGUI::IFont* font = resource->castType<MyGUI::IFont>();

			// выво?реальног?размер?шрифта
			mFontHeight = font->getDefaultHeight();
			mTextPix->setCaption(MyGUI::utility::toString("Height of a font is ", mFontHeight, " pixels"));

			mFontView->setFontName(mFontName);
			mTextureView->setFontName(mFontName);
		}
	}
开发者ID:siangzhang,项目名称:starworld,代码行数:47,代码来源:FontPanel.cpp


示例12: saveSettings

	void SettingsManager::saveSettings(const MyGUI::UString& _fileName)
	{
		std::string _instance = "Editor";

		MyGUI::xml::Document doc;
		doc.createDeclaration();
		MyGUI::xml::ElementPtr root = doc.createRoot("MyGUI");
		root->addAttribute("type", "Settings");

		saveSectors(root);

		if (!doc.save(_fileName))
		{
			MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError());
			return;
		}
	}
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:17,代码来源:SettingsManager.cpp


示例13: 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));
	}
开发者ID:2asoft,项目名称:MMO-Framework,代码行数:17,代码来源:FontExportSerializer.cpp


示例14: save

bool HotkeyManager::save( string xml )
{
	MyGUI::xml::Document doc;
	string path = Game::getSingleton().getResourcePath() + xml;
	MyGUI::xml::ElementPtr root = doc.createRoot("HKS");
	doc.createDeclaration();
	MyGUI::xml::ElementPtr node;

	for( HotkeyTable::iterator it = mHotkeys.begin();it!=mHotkeys.end();++it )
	{
		node = root->createChild("hotkey");
		node->addAttribute("name",it->mName);
		node->addAttribute("caption",it->mCaption);
		node->addAttribute("tip",it->mTip);
		node->addAttribute("key",it->mHotkey);
	}
	return doc.save( path );
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:18,代码来源:HotkeyManager.cpp


示例15: saveSettings

void EditorState::saveSettings(const MyGUI::UString& _fileName)
{
	std::string _instance = "Editor";

	MyGUI::xml::Document doc;
	doc.createDeclaration();
	MyGUI::xml::ElementPtr root = doc.createRoot("MyGUI");
	root->addAttribute("type", "Settings");

	mPropertiesPanelView->save(root);
	mSettingsWindow->save(root);
	mWidgetsWindow->save(root);
	mMetaSolutionWindow->save(root);

	// cleanup for duplicates

	std::reverse(recentFiles.begin(), recentFiles.end());
	for (size_t i = 0; i < recentFiles.size(); ++i)
		recentFiles.erase(std::remove(recentFiles.begin() + i + 1, recentFiles.end(), recentFiles[i]), recentFiles.end());

	// remove old files
	while (recentFiles.size() > MAX_RECENT_FILES)
		recentFiles.pop_back();
	std::reverse(recentFiles.begin(), recentFiles.end());

	for (std::vector<MyGUI::UString>::iterator iter = recentFiles.begin(); iter != recentFiles.end(); ++iter)
	{
		MyGUI::xml::ElementPtr nodeProp = root->createChild("RecentFile");
		nodeProp->addAttribute("name", *iter);
	}

	for (std::vector<MyGUI::UString>::iterator iter = additionalPaths.begin(); iter != additionalPaths.end(); ++iter)
	{
		MyGUI::xml::ElementPtr nodeProp = root->createChild("AdditionalPath");
		nodeProp->addAttribute("name", *iter);
	}

	if (!doc.save(_fileName))
	{
		MYGUI_LOGGING(LogSection, Error, _instance << " : " << doc.getLastError());
		return;
	}
}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:43,代码来源:EditorState.cpp


示例16: load

/*从xml加载热键
	
*/
bool HotkeyManager::load( string xml )
{
	MyGUI::xml::Document doc;
	string path = Game::getSingleton().getResourcePath() + xml;
	if( !doc.open( path ) )
	{
		MyGUI::IDataStream* pdata = MyGUI::DataManager::getInstance().getData(xml);
		if( pdata )
			doc.open( pdata );
		MyGUI::DataManager::getInstance().freeData(pdata);
	}

	MyGUI::xml::ElementPtr root = doc.getRoot();
	if( root )
	{
		_load( root,xml );
		return true;
	}
	
	WARNING_LOG("HotkeyManager can't load "<<xml);
	return false;
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:25,代码来源:HotkeyManager.cpp


示例17: 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());
			}
		}
	}
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:45,代码来源:SettingsManager.cpp


示例18: 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);
	}
开发者ID:siangzhang,项目名称:starworld,代码行数:19,代码来源:ExportManager.cpp


示例19: 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")));
					}
				}
			}
		}

	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:66,代码来源:DemoKeeper.cpp


示例20: saveToFile

	void DemoKeeper::saveToFile(const std::string& _filename)
	{
		MyGUI::xml::Document doc;

		// есть такой файл
		if (!doc.open(_filename))
		{
			doc.clear();
		}

		doc.createDeclaration();
		MyGUI::xml::ElementPtr root = doc.createRoot("AnimationGraph");

		// сохраняем сами ноды
		wraps::BaseGraphView::EnumeratorNode node = mGraphView->getNodeEnumerator();
		while (node.next())
		{
			BaseAnimationNode* anim_node = dynamic_cast<BaseAnimationNode*>(node.current());
			if (anim_node)
			{
				MyGUI::xml::ElementPtr node_type = root->createChild("Node");
				node_type->addAttribute("type", anim_node->getType());
				node_type->addAttribute("name", anim_node->getName());
				anim_node->serialization(node_type);
			}
		}

		// сохраняем соединения
		node = mGraphView->getNodeEnumerator();
		while (node.next())
		{
			BaseAnimationNode* anim_node = dynamic_cast<BaseAnimationNode*>(node.current());
			if (anim_node && anim_node->isAnyConnection())
			{
				MyGUI::xml::ElementPtr connection = root->createChild("Connections");
				connection->addAttribute("node", anim_node->getName());

				wraps::EnumeratorConnection node_conn = anim_node->getConnectionEnumerator();
				while (node_conn.next())
				{
					wraps::EnumeratorConnection conn = node_conn->getConnectionEnumerator();
					while (conn.next())
					{
						BaseAnimationNode* anim_node2 = dynamic_cast<BaseAnimationNode*>(conn->getOwnerNode());
						if (anim_node2)
						{
							MyGUI::xml::ElementPtr item = connection->createChild("Connection");
							item->addAttribute("node", anim_node2->getName());
							item->addAttribute("from", node_conn->getName());
							item->addAttribute("to", conn->getName());
						}
					}
				}
			}
		}

		// сохраняем данные для редактора
		MyGUI::xml::ElementPtr data = root->createChild("EditorData");
		node = mGraphView->getNodeEnumerator();
		while (node.next())
		{
			BaseAnimationNode* anim_node = dynamic_cast<BaseAnimationNode*>(node.current());
			if (anim_node)
			{
				MyGUI::xml::ElementPtr item_data = data->createChild("Node");
				item_data->addAttribute("name", anim_node->getName());
				item_data->addAttribute("coord", anim_node->getCoord().print());
			}
		}

		doc.save(_filename);
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:72,代码来源:DemoKeeper.cpp



注:本文中的mygui::xml::Document类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ xml::ElementEnumerator类代码示例发布时间:2022-05-31
下一篇:
C++ mygui::Window类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap