当前位置: 首页>>代码示例>>C++>>正文


C++ CL_DomElement::get_tag_name方法代码示例

本文整理汇总了C++中CL_DomElement::get_tag_name方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_DomElement::get_tag_name方法的具体用法?C++ CL_DomElement::get_tag_name怎么用?C++ CL_DomElement::get_tag_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CL_DomElement的用法示例。


在下文中一共展示了CL_DomElement::get_tag_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: impl

CL_Collada_Triangles::CL_Collada_Triangles(CL_DomElement &element, std::vector<CL_Collada_Source> &sources, CL_Collada_Vertices &vertices, std::vector<CL_Collada_Material> &library_materials) : impl(new CL_Collada_Triangles_Impl())
{
	bool contains_vcount;
	if (element.get_tag_name() == "polylist")
	{
		contains_vcount = true;
	}
	else
	{
		contains_vcount = false;
	}

	impl->load_polylist(element, contains_vcount, sources, vertices, library_materials);
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:14,代码来源:collada_triangles.cpp

示例2: Exception

SpriteResource::SpriteResource(CL_Resource &resource)
: mResource(resource)
{
	GAME_ASSERT(mResource.get_type() == "sprite");

	std::string basePath = mResource.get_manager().get_directory(mResource).get_file_system().get_path();
	for (CL_DomElement element = mResource.get_element().get_first_child_element(); !element.is_null(); element = element.get_next_sibling_element())
		if (element.get_tag_name() == "image")
		{
			std::string fileName = element.get_attribute("file");
			if (fileName.empty())
				throw Exception("Sprite '" + mResource.get_name() + "' has empty or missing 'file' attribute");
			mFrames.insert(std::make_pair(basePath + fileName, Frame(fileName)));
		}

	if (mFrames.empty())
		throw Exception("Sprite '" + mResource.get_name() + "' has no frames");
}
开发者ID:ermachkov,项目名称:Balance_GUI,代码行数:18,代码来源:SpriteResource.cpp

示例3: cloneElement

//рекурсивное клонирование XML-элемента
CL_DomElement cloneElement(CL_DomElement &element, CL_DomDocument &doc)
{
	//создаем элемент-клон
	CL_DomElement clone(doc, element.get_tag_name());

	//копируем атрибуты
	CL_DomNamedNodeMap attributes = element.get_attributes();
	unsigned long length = attributes.get_length();
	for (unsigned long i = 0; i < length; ++i)
	{
		CL_DomNode attr = attributes.item(i);
		clone.set_attribute(attr.get_node_name(), attr.get_node_value());
	}

	//рекурсивно копируем дочерние элементы
	for (CL_DomElement child = element.get_first_child_element(); !child.is_null(); child = child.get_next_sibling_element())
		clone.append_child(cloneElement(child, doc));

	//возвращаем клонированный элемент
	return clone;
}
开发者ID:ermachkov,项目名称:bmgui,代码行数:22,代码来源:main.cpp

示例4: load

void ReferenceFunction::load(CL_String member_name, CL_DomElement class_element)
{
	if (class_element.get_tag_name() != "compounddef")
		throw CL_Exception("Expected compounddef element");

	name = member_name;

	CL_DomNode cur_node;
	for (cur_node = class_element.get_first_child(); !cur_node.is_null(); cur_node = cur_node.get_next_sibling())
	{
		CL_DomElement cur_element = cur_node.to_element();
		if (cur_element.is_null()) continue;

		CL_String tag_name = cur_element.get_tag_name();
		if ( (tag_name == "sectiondef") && (
			(cur_element.get_attribute("kind") == "user-defined") ||
			(cur_element.get_attribute("kind") == "public-func") ||
			(cur_element.get_attribute("kind") == "public-static-func") ) )
		{
			parse_sectiondef(cur_element);
		}
	}
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:23,代码来源:reference_function.cpp

示例5: main


//.........这里部分代码省略.........
			imageElement.append_child(GridElement);
		}

		//прервать выполнение сохранения, если анимации нет
		if (!iter_sprites->mIsFrame)
			continue;

		for(S_Sprite::T_Images::iterator iter_images = iter_sprites->mImages.begin(); iter_images != iter_sprites->mImages.end(); ++iter_images)
		{
			//элемент frame
			CL_DomElement frameElement(resourceXML, "frame");
			frameElement.set_attribute_int("nr", iter_images - iter_sprites->mImages.begin());
			if (iter_images->mDelay != 0)
				frameElement.set_attribute_int("speed", iter_images->mDelay);
			frameElement.set_attribute_int("x", iter_images->mOffset.x);
			frameElement.set_attribute_int("y", iter_images->mOffset.y);
			spriteElement.append_child(frameElement);
		}
	}

	//подключение всех файлов с дополнительными ресурсами
	directoryScanner.scan(workDirectoryName, "*.xml");
	while (directoryScanner.next())
	{
		//проверка валидности файла
		if (directoryScanner.is_directory() || directoryScanner.get_name() == RESOURCES_FILE_NAME)
			continue;

		//открытие ресурсного XML файла
		CL_Console::write_line("include xml file: " + directoryScanner.get_pathname());
		CL_File file(directoryScanner.get_pathname());
		CL_DomDocument doc(file);
		CL_DomElement root = doc.get_document_element();
		if (root.get_tag_name() != "resources")
		{
			CL_Console::write_line("Root name can't be: %1", root.get_tag_name());
			return PrintError("");
		}

		//добавление всех ресурсов в текущий документ
		for (CL_DomElement element = root.get_first_child_element(); !element.is_null(); element = element.get_next_sibling_element())
			resourcesElement.append_child(cloneElement(element, resourceXML));
	}

	//сохранение в файл XML структуры
	resourceXML.save(fileResourceXML);
	
	//закрытие файла
	fileResourceXML.close();

	//сохранение координат спрайтов и инициализации/деинициализации в lua скрипте
	//формирование имени файла
	//CL_String luaFileName = CL_PathHelp::make_absolute(workDirectoryName, locationName + ".lua");
	CL_String luaFileName = CL_PathHelp::make_absolute(workDirectoryName, LUA_SCRIPT_NAME);
	CL_File luaFile;
	is_opened = luaFile.open(luaFileName, CL_File::create_always, CL_File::access_write);
	if( !is_opened )
		return PrintError( CL_String("Can't open file: ") + luaFileName);


	luaFile.write_string_text( cl_format("function %1_createSprites()", locationName) );
	//запись в XML файл ресурсов результирующих прямоугольников
	for(T_Sprites::iterator iter_sprites = sprites.begin(); iter_sprites != sprites.end(); ++iter_sprites)
	{
		CL_String currentResourceName = iter_sprites->mName;
		int x = iter_sprites->mPos.x;
开发者ID:ermachkov,项目名称:bmgui,代码行数:67,代码来源:main.cpp

示例6: if

void CL_GUIXMLLoaderVersion_1_0::load(CL_DomElement &element, CL_GUIComponent *parent)
{
	CL_DomElement e = element.get_first_child().to_element();

	dialog_width = 0;
	dialog_height = 0;

	while (e.is_element())
	{
		CL_String tag = e.get_tag_name();
		CL_GUIComponent *new_comp = 0;

		if (tag == "button")
		{
			CL_PushButton *co = new CL_PushButton(parent);
			if (e.has_attribute("text"))
				co->set_text(e.get_attribute("text"));
			new_comp = co;
		}
		else if (tag == "checkbox")
		{
			CL_CheckBox *co = new CL_CheckBox(parent);
			if (e.has_attribute("text"))
				co->set_text(e.get_attribute("text"));
			new_comp = co;
		}
		else if (tag == "radiobutton")
		{
			CL_RadioButton *co = new CL_RadioButton(parent);
			if (e.has_attribute("text"))
				co->set_text(e.get_attribute("text"));
			if (e.has_attribute("group"))
				co->set_group_name(e.get_attribute("group"));
			new_comp = co;
		}
		else if (tag == "label")
		{
			CL_Label *co = new CL_Label(parent);
			if (e.has_attribute("text"))
				co->set_text(e.get_attribute("text"));
			new_comp = co;
		}
		else if (tag == "toolbar")
		{
			CL_ToolBar *co = new CL_ToolBar(parent);
			new_comp = co;
		}
		else if (tag == "progressbar")
		{
			CL_ProgressBar *co = new CL_ProgressBar(parent);
			new_comp = co;
		}
		else if (tag == "lineedit")
		{
			CL_LineEdit *co = new CL_LineEdit(parent);
			if (e.has_attribute("text"))
				co->set_text(e.get_attribute("text"));
			new_comp = co;
		}
		else if (tag == "slider")
		{
			CL_Slider *co = new CL_Slider(parent);
			co->set_min(CL_StringHelp::text_to_int(e.get_attribute("min")));
			co->set_max(CL_StringHelp::text_to_int(e.get_attribute("max")));
			co->set_tick_count(CL_StringHelp::text_to_int(e.get_attribute("ticks")));
			co->set_page_step(CL_StringHelp::text_to_int(e.get_attribute("page_step")));
			new_comp = co;
		}
		else if (tag == "listview")
		{
			CL_ListView *co = new CL_ListView(parent);
			CL_ListViewHeader *header = co->get_header();

			std::vector<CL_DomNode> columns_nodes = e.select_nodes("listview_header/listview_column");
			for(size_t i = 0; i < columns_nodes.size(); ++i)
			{
				CL_DomElement column_element = columns_nodes[i].to_element();
				CL_String id = column_element.get_attribute("col_id");
				CL_String caption = column_element.get_attribute("caption");
				int width = column_element.get_attribute_int("width");

				CL_ListViewColumnHeader column = header->create_column(id, caption);
				column.set_width(width);
				header->append(column);
			}

			new_comp = co;
		}
		else if (tag == "tab")
		{
			CL_Tab *co = new CL_Tab(parent);
			new_comp = co;

			CL_DomElement tab_child = e.get_first_child().to_element();
			while (tab_child.is_element())
			{
				if (tab_child.get_tag_name() == "tabpage")
				{
					CL_String label = tab_child.get_attribute("label", "Error: NO LABEL!");
					int id = CL_StringHelp::text_to_int(tab_child.get_attribute("id", "0"));
//.........这里部分代码省略.........
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:101,代码来源:gui_xml_loader_version_1_0.cpp


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