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


C++ TTiXmlNode::ToElement方法代码示例

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


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

示例1: NextSiblingElement

TTiXmlElement* TTiXmlNode::NextSiblingElement( const char * _value )
{
	TTiXmlNode* node;

	for (	node = NextSibling( _value );
	node;
	node = node->NextSibling( _value ) )
	{
		if ( node->ToElement() )
			return node->ToElement();
	}
	return 0;
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:13,代码来源:tinyxml.cpp

示例2: FirstChildElement

TTiXmlElement* TTiXmlNode::FirstChildElement()
{
	TTiXmlNode* node;

	for (	node = FirstChild();
			node;
			node = node->NextSibling() )
	{
		if ( node->ToElement() )
			return node->ToElement();
	}
	return 0;
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:13,代码来源:tinyxml.cpp

示例3: StreamIn

void TTiXmlDocument::StreamIn( TTiXml_ISTREAM * in, TTiXml_STRING * tag )
{
	// The basic issue with a document is that we don't know what we're
	// streaming. Read something presumed to be a tag (and hope), then
	// identify it, and call the appropriate stream method on the tag.
	//
	// This "pre-streaming" will never read the closing ">" so the
	// sub-tag can orient itself.

	if ( !StreamTo( in, '<', tag ) ) 
	{
		SetError( TTiXml_ERROR_PARSING_EMPTY, 0, 0, TTiXml_ENCODING_UNKNOWN );
		return;
	}

	while ( in->good() )
	{
		int tagIndex = (int) tag->length();
		while ( in->good() && in->peek() != '>' )
		{
			int c = in->get();
			if ( c <= 0 )
			{
				SetError( TTiXml_ERROR_EMBEDDED_NULL, 0, 0, TTiXml_ENCODING_UNKNOWN );
				break;
			}
			(*tag) += (char) c;
		}

		if ( in->good() )
		{
			// We now have something we presume to be a node of 
			// some sort. Identify it, and call the node to
			// continue streaming.
			TTiXmlNode* node = Identify( tag->c_str() + tagIndex, TTiXml_DEFAULT_ENCODING );

			if ( node )
			{
				node->StreamIn( in, tag );
				bool isElement = node->ToElement() != 0;
				delete node;
				node = 0;

				// If this is the root element, we're done. Parsing will be
				// done by the >> operator.
				if ( isElement )
				{
					return;
				}
			}
			else
			{
				SetError( TTiXml_ERROR, 0, 0, TTiXml_ENCODING_UNKNOWN );
				return;
			}
		}
	}
	// We should have returned sooner.
	SetError( TTiXml_ERROR, 0, 0, TTiXml_ENCODING_UNKNOWN );
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:60,代码来源:tinyxmlparser.cpp


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