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


C++ TiXmlNodeA类代码示例

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


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

示例1: TEXT

bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message)
{
	title = TEXT("");
	message = TEXT("");

	if (!_nativeLangA) return false;

	TiXmlNodeA *msgBoxNode = _nativeLangA->FirstChild("MessageBox");
	if (!msgBoxNode) return false;

	msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName);
	if (!msgBoxNode) return false;

	WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();

	// Set Title
	const char *titre = (msgBoxNode->ToElement())->Attribute("title");
	const char *msg = (msgBoxNode->ToElement())->Attribute("message");
	if ((titre && titre[0]) && (msg && msg[0]))
	{
		title = wmc->char2wchar(titre, _nativeLangEncoding);
		message = wmc->char2wchar(msg, _nativeLangEncoding);
		return true;
	}
	return false;
}
开发者ID:SinghRajenM,项目名称:notepad-plus-plus,代码行数:26,代码来源:localization.cpp

示例2: 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

示例3: GetDocument

const char* TiXmlElementA::ReadValue( const char* p, TiXmlParsingDataA* data )
{
	TiXmlDocumentA* document = GetDocument();

	// Read in text and elements in any order.
	p = SkipWhiteSpace( p );
	while ( p && *p )
	{
		if ( *p != '<' )
		{
			// Take what we have, make a text element.
			TiXmlTextA* textNode = new TiXmlTextA( "" );

			if ( !textNode )
			{
				if ( document )
				{
					document->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, 0, 0 );
				}
				return 0;
			}

			p = textNode->Parse( p, data );

			if ( !textNode->Blank() )
				LinkEndChild( textNode );
			else
				delete textNode;
		}
		else
		{
			// We hit a '<'
			// Have we hit a new element or an end tag?
			if ( StringEqual( p, "</", false ) )
			{
				return p;
			}
			else
			{
				TiXmlNodeA* node = Identify( p );
				if ( node )
				{
					p = node->Parse( p, data );
					LinkEndChild( node );
				}
				else
				{
					return 0;
				}
			}
		}
		p = SkipWhiteSpace( p );
	}

	if ( !p )
	{
		if ( document ) document->SetError( TIXMLA_ERROR_READING_ELEMENT_VALUE, 0, 0 );
	}
	return p;
}
开发者ID:Oldes,项目名称:npp-community,代码行数:60,代码来源:tinyxmlparserA.cpp

示例4: Print

void TiXmlDocumentA::Print( FILE* cfile, int depth ) const
{
	TiXmlNodeA* node;
	for ( node=FirstChild(); node; node=node->NextSibling() )
	{
		node->Print( cfile, depth );
		fprintf( cfile, "\n" );
	}
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:9,代码来源:tinyxmlA.cpp

示例5: FirstChild

TiXmlNodeA* TiXmlNodeA::FirstChild( const char * _value ) const
{
	TiXmlNodeA* node;
	for ( node = firstChild; node; node = node->next )
	{
		if ( node->SValue() == TIXMLA_STRING( _value ))
			return node;
	}
	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:10,代码来源:tinyxmlA.cpp

示例6: NextSibling

TiXmlNodeA* TiXmlNodeA::NextSibling( const char * _value ) const
{
	TiXmlNodeA* node;
	for ( node = next; node; node = node->next )
	{
		if ( node->SValue() == TIXMLA_STRING (_value))
			return node;
	}
	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:10,代码来源:tinyxmlA.cpp

示例7: PreviousSibling

TiXmlNodeA* TiXmlNodeA::PreviousSibling( const char * _value ) const
{
	TiXmlNodeA* node;
	for ( node = prev; node; node = node->prev )
	{
		if ( node->SValue() == TIXMLA_STRING (_value))
			return node;
	}
	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:10,代码来源:tinyxmlA.cpp

示例8: LastChild

TiXmlNodeA* TiXmlNodeA::LastChild( const char * _value ) const
{
	TiXmlNodeA* node;
	for ( node = lastChild; node; node = node->prev )
	{
		if ( node->SValue() == TIXMLA_STRING (_value))
			return node;
	}
	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:10,代码来源:tinyxmlA.cpp

示例9: ClearError

const char* TiXmlDocumentA::Parse( const char* p, TiXmlParsingDataA* prevData )
{
	ClearError();

	// Parse away, at the document level. Since a document
	// contains nothing but other tags, most of what happens
	// here is skipping white space.
	if ( !p || !*p )
	{
		SetError( TIXMLA_ERROR_DOCUMENT_EMPTY, 0, 0 );
		return 0;
	}

	// Note that, for a document, this needs to come
	// before the while space skip, so that parsing
	// starts from the pointer we are given.
	location.Clear();
	if ( prevData )
	{
		location.row = prevData->cursor.row;
		location.col = prevData->cursor.col;
	}
	else
	{
		location.row = 0;
		location.col = 0;
	}
	TiXmlParsingDataA data( p, TabSize(), location.row, location.col );
	location = data.Cursor();

    p = SkipWhiteSpace( p );
	if ( !p )
	{
		SetError( TIXMLA_ERROR_DOCUMENT_EMPTY, 0, 0 );
		return 0;
	}

	while ( p && *p )
	{
		TiXmlNodeA* node = Identify( p );
		if ( node )
		{
			p = node->Parse( p, &data );
			LinkEndChild( node );
		}
		else
		{
			break;
		}
		p = SkipWhiteSpace( p );
	}

	// All is well.
	return p;
}
开发者ID:berserkerkira,项目名称:NotePlus,代码行数:55,代码来源:tinyxmlparsera.cpp

示例10: SetError

void TiXmlDocumentA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_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( TIXMLA_ERROR_PARSING_EMPTY, 0, 0 );
		return;
	}

	while ( in->good() )
	{
		int tagIndex = tag->length();
		while ( in->good() && in->peek() != '>' )
		{
			int c = in->get();
			(*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.
			TiXmlNodeA* node = Identify( tag->c_str() + tagIndex );

			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( TIXMLA_ERROR, 0, 0 );
				return;
			}
		}
	}
	// We should have returned sooner.
	SetError( TIXMLA_ERROR, 0, 0 );
}
开发者ID:berserkerkira,项目名称:NotePlus,代码行数:55,代码来源:tinyxmlparsera.cpp

示例11: searchDlgNode

void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdminDlg)
{
	if (_nativeLangA)
	{
		TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog");
		if (dlgNode)
		{
			dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg");
			if (dlgNode)
			{
				WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();

				TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin");
				if (ColumnPluginNode)
				{
					const char *name = (ColumnPluginNode->ToElement())->Attribute("name");
					if (name && name[0])
					{
						basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
						pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str());
					}
				}

				TiXmlNodeA *ColumnVersionNode = dlgNode->FirstChild("ColumnVersion");
				if (ColumnVersionNode)
				{
					const char *name = (ColumnVersionNode->ToElement())->Attribute("name");
					if (name && name[0])
					{
						basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
						pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str());
					}
				}

				const char *titre1 = (dlgNode->ToElement())->Attribute("titleAvailable");
				const char *titre2 = (dlgNode->ToElement())->Attribute("titleUpdates");
				const char *titre3 = (dlgNode->ToElement())->Attribute("titleInstalled");

				if (titre1 && titre1[0])
				{
					basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
					pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str());
				}
				if (titre2  && titre2[0])
				{
					basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
					pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str());
				}
				if (titre3 && titre3[0])
				{
					basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
					pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str());
				}
			}

			changeDlgLang(pluginsAdminDlg.getHSelf(), "PluginsAdminDlg");
		}
	}
}
开发者ID:SinghRajenM,项目名称:notepad-plus-plus,代码行数:59,代码来源:localization.cpp

示例12: NextSiblingElement

TiXmlElementA* TiXmlNodeA::NextSiblingElement( const char * _value ) const
{
	TiXmlNodeA* node;

	for (	node = NextSibling( _value );
	node;
	node = node->NextSibling( _value ) )
	{
		if ( node->ToElement() )
			return node->ToElement();
	}
	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:13,代码来源:tinyxmlA.cpp

示例13: FirstChildElement

TiXmlElementA* TiXmlNodeA::FirstChildElement() const
{
	TiXmlNodeA* node;

	for (	node = FirstChild();
	node;
	node = node->NextSibling() )
	{
		if ( node->ToElement() )
			return node->ToElement();
	}
	return 0;
}
开发者ID:A-R-C-A,项目名称:notepad-plus-plus,代码行数:13,代码来源:tinyxmlA.cpp

示例14: 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

示例15: getSpecialMenuEntryName

generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName) const
{
	if (!_nativeLangA) return TEXT("");
	TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu");
	if (!mainMenu) return TEXT("");
	mainMenu = mainMenu->FirstChild("Main");
	if (!mainMenu) return TEXT("");
	TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
	if (!entriesRoot) return TEXT("");

	WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();

	for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
		childNode ;
		childNode = childNode->NextSibling("Item") )
	{
		TiXmlElementA *element = childNode->ToElement();

		const char *idName = element->Attribute("idName");
		if (idName)
		{
			const char *name = element->Attribute("name");
			if (!strcmp(idName, entryName))
			{
				return wmc->char2wchar(name, _nativeLangEncoding);
			}
		}
	}
	return TEXT("");
}
开发者ID:SinghRajenM,项目名称:notepad-plus-plus,代码行数:30,代码来源:localization.cpp


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