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


C++ TiXmlAttributeA类代码示例

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


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

示例1: StreamOut

void TiXmlElementA::StreamOut( TIXMLA_OSTREAM * stream ) const
{
	(*stream) << "<" << value;

	TiXmlAttributeA* attrib;
	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
	{	
		(*stream) << " ";
		attrib->StreamOut( stream );
	}

	// If this node has children, give it a closing tag. Else
	// make it an empty tag.
	TiXmlNodeA* node;
	if ( firstChild )
	{ 		
		(*stream) << ">";

		for ( node = firstChild; node; node=node->NextSibling() )
		{
			node->StreamOut( stream );
		}
		(*stream) << "</" << value << ">";
	}
	else
	{
		(*stream) << " />";
	}
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:29,代码来源:tinyxmlA.cpp

示例2: QueryDoubleAttribute

int TiXmlElementA::QueryDoubleAttribute( const char* name, double* dval ) const
{
	TiXmlAttributeA* node = attributeSet.Find( name );
	if ( !node )
		return TIXMLA_NO_ATTRIBUTE;

	return node->QueryDoubleValue( dval );
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:8,代码来源:tinyxmlA.cpp

示例3: QueryIntAttribute

int TiXmlElementA::QueryIntAttribute( const char* name, int* ival ) const
{
	TiXmlAttributeA* node = attributeSet.Find( name );
	if ( !node )
		return TIXMLA_NO_ATTRIBUTE;

	return node->QueryIntValue( ival );
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:8,代码来源:tinyxmlA.cpp

示例4:

const char * TiXmlElementA::Attribute( const char * name ) const
{
	TiXmlAttributeA* node = attributeSet.Find( name );

	if ( node )
		return node->Value();

	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:9,代码来源:tinyxmlA.cpp

示例5: SkipWhiteSpace

const char* TiXmlDeclarationA::Parse( const char* p, TiXmlParsingDataA* data )
{
	p = SkipWhiteSpace( p );
	// Find the beginning, find the end, and look for
	// the stuff in-between.
	TiXmlDocumentA* document = GetDocument();
	if ( !p || !*p || !StringEqual( p, "<?xml", true ) )
	{
		if ( document ) document->SetError( TIXMLA_ERROR_PARSING_DECLARATION, 0, 0 );
		return 0;
	}
//	TiXmlParsingDataA data( p, prevData );
	if ( data )
	{
		data->Stamp( p );
		location = data->Cursor();
	}
	p += 5;

	version = "";
	encoding = "";
	standalone = "";

	while ( p && *p )
	{
		if ( *p == '>' )
		{
			++p;
			return p;
		}

		p = SkipWhiteSpace( p );
		if ( StringEqual( p, "version", true ) )
		{
			TiXmlAttributeA attrib;
			p = attrib.Parse( p, data );		
			version = attrib.Value();
		}
		else if ( StringEqual( p, "encoding", true ) )
		{
			TiXmlAttributeA attrib;
			p = attrib.Parse( p, data );		
			encoding = attrib.Value();
		}
		else if ( StringEqual( p, "standalone", true ) )
		{
			TiXmlAttributeA attrib;
			p = attrib.Parse( p, data );		
			standalone = attrib.Value();
		}
		else
		{
			// Read over whatever it is.
			while( p && *p && *p != '>' && !isspace( *p ) )
				++p;
		}
	}
	return 0;
}
开发者ID:berserkerkira,项目名称:NotePlus,代码行数:59,代码来源:tinyxmlparsera.cpp

示例6: fprintf

void TiXmlElementA::Print( FILE* cfile, int depth ) const
{
	int i;
	for ( i=0; i<depth; i++ )
	{
		fprintf( cfile, "    " );
	}

	fprintf( cfile, "<%s", value.c_str() );

	TiXmlAttributeA* attrib;
	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
	{
		fprintf( cfile, " " );
		attrib->Print( cfile, depth );
	}

	// There are 3 different formatting approaches:
	// 1) An element without children is printed as a <foo /> node
	// 2) An element with only a text child is printed as <foo> text </foo>
	// 3) An element with children is printed on multiple lines.
	TiXmlNodeA* node;
	if ( !firstChild )
	{
		fprintf( cfile, " />" );
	}
	else if ( firstChild == lastChild && firstChild->ToText() )
	{
		fprintf( cfile, ">" );
		firstChild->Print( cfile, depth + 1 );
		fprintf( cfile, "</%s>", value.c_str() );
	}
	else
	{
		fprintf( cfile, ">" );

		for ( node = firstChild; node; node=node->NextSibling() )
		{
			if ( !node->ToText() )
			{
				fprintf( cfile, "\n" );
			}
			node->Print( cfile, depth+1 );
		}
		fprintf( cfile, "\n" );
		for( i=0; i<depth; ++i )
		fprintf( cfile, "    " );
		fprintf( cfile, "</%s>", value.c_str() );
	}
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:50,代码来源:tinyxmlA.cpp

示例7: TiXmlAttributeA

void TiXmlElementA::SetAttribute( const char * name, const char * _value )
{
	TiXmlAttributeA* node = attributeSet.Find( name );
	if ( node )
	{
		node->SetValue( _value );
		return;
	}

	TiXmlAttributeA* attrib = new TiXmlAttributeA( name, _value );
	if ( attrib )
	{
		attributeSet.Add( attrib );
	}
	else
	{
		TiXmlDocumentA* document = GetDocument();
		if ( document ) document->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, 0, 0 );
	}
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:20,代码来源:tinyxmlA.cpp

示例8: TiXmlElementA

TiXmlNodeA* TiXmlElementA::Clone() const
{
	TiXmlElementA* clone = new TiXmlElementA( Value() );
	if ( !clone )
		return 0;

	CopyToClone( clone );

	// Clone the attributes, then clone the children.
	for(TiXmlAttributeA* attribute = attributeSet.First();
		attribute;
		attribute = attribute->Next() )
	{
		clone->SetAttribute( attribute->Name(), attribute->Value() );
	}

	for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() )
	{
		clone->LinkEndChild( node->Clone() );
	}
	return clone;
}
开发者ID:bruderstein,项目名称:npp-community,代码行数:22,代码来源:tinyxmlA.cpp


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