本文整理汇总了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;
}
示例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) << " />";
}
}
示例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;
}
示例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" );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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");
}
}
}
示例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;
}
示例13: FirstChildElement
TiXmlElementA* TiXmlNodeA::FirstChildElement() const
{
TiXmlNodeA* node;
for ( node = FirstChild();
node;
node = node->NextSibling() )
{
if ( node->ToElement() )
return node->ToElement();
}
return 0;
}
示例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() );
}
}
示例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("");
}