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


C++ XMLAttribute::getNextAttrib方法代码示例

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


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

示例1: parseNode

void SceneGraphResource::parseNode( XMLNode &xmlNode, SceneNodeTpl *parentTpl )
{
	SceneNodeTpl *nodeTpl = 0x0;

	if( xmlNode.getName() != 0x0 )	// Ignore clear tags like DOCTYPE
	{
		if( strcmp( xmlNode.getName(), "Reference" ) == 0 )
		{
			if( strcmp( xmlNode.getAttribute( "sceneGraph", "" ), "" ) != 0 )
			{
				Resource *res = Modules::resMan().resolveResHandle( Modules::resMan().addResource(
					ResourceTypes::SceneGraph, xmlNode.getAttribute( "sceneGraph" ), 0, false ) );
				if (res != 0x0 ) nodeTpl = new ReferenceNodeTpl( "", (SceneGraphResource *)res );
			}
		}
		else
		{
			NodeRegEntry *entry = Modules::sceneMan().findType( xmlNode.getName() );
			if( entry != 0x0 )
			{
				map< string, string > attribs;
				
				// Parse custom attributes
				XMLAttribute attrib = xmlNode.getFirstAttrib();
				while( !attrib.isEmpty() )
				{
					if( strcmp( attrib.getName(), "name" ) != 0 &&
						strcmp( attrib.getName(), "tx" ) != 0 &&
						strcmp( attrib.getName(), "ty" ) != 0 &&
						strcmp( attrib.getName(), "tz" ) != 0 &&
						strcmp( attrib.getName(), "rx" ) != 0 &&
						strcmp( attrib.getName(), "ry" ) != 0 &&
						strcmp( attrib.getName(), "rz" ) != 0 &&
						strcmp( attrib.getName(), "sx" ) != 0 &&
						strcmp( attrib.getName(), "sy" ) != 0 &&
						strcmp( attrib.getName(), "sz" ) != 0 )
					{
						attribs[attrib.getName()] = attrib.getValue();
					}
					attrib = attrib.getNextAttrib();
				}

				// Call function pointer
				nodeTpl = (*entry->parsingFunc)( attribs );
			}
		}
		
		if( nodeTpl != 0x0 )
		{
			// Parse base attributes
			parseBaseAttributes( xmlNode, *nodeTpl );
			
			// Add to parent
			if( parentTpl != 0x0 )
			{
				parentTpl->children.push_back( nodeTpl );
			}
			else
			{	
				delete _rootNode;	// Delete default root
				_rootNode = nodeTpl;
			}
		}
		else if( strcmp( xmlNode.getName(), "Attachment" ) != 0 )
		{
			Modules::log().writeWarning( "SceneGraph resource '%s': Unknown node type or missing attribute for '%s'",
										 _name.c_str(), xmlNode.getName() );
			return;
		}
	}
	
	// Parse children
	XMLNode xmlNode1 = xmlNode.getFirstChild();
	while( !xmlNode1.isEmpty() )
	{	
		if( xmlNode1.getName() == 0x0 || strcmp( xmlNode1.getName(), "Attachment" ) != 0 )			
			parseNode( xmlNode1, nodeTpl );

		xmlNode1 = xmlNode1.getNextSibling();
	}
}
开发者ID:okard,项目名称:td,代码行数:81,代码来源:egSceneGraphRes.cpp


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