api update

This commit is contained in:
Glenn Maynard
2006-10-02 22:47:53 +00:00
parent 30d91df8f4
commit 65d23319f1
+13 -13
View File
@@ -150,8 +150,8 @@ unsigned LoadAttributes( XNode *pNode, const RString &xml, RString &sErrorOut, u
// add new attribute // add new attribute
DEBUG_ASSERT( sName.size() ); DEBUG_ASSERT( sName.size() );
pair<XAttrs::iterator,bool> it = pNode->m_attrs.insert( make_pair(sName, RString()) ); pair<XAttrs::iterator,bool> it = pNode->m_attrs.insert( make_pair(sName, XNodeValue()) );
RString &sValue = it.first->second; RString &sValue = it.first->second.m_sValue;
iOffset = iEnd; iOffset = iEnd;
// XML Attr Value // XML Attr Value
@@ -295,7 +295,7 @@ unsigned XmlFileUtil::Load( XNode *pNode, const RString &xml, RString &sErrorOut
// open/close tag <TAG ..> ... </TAG> // open/close tag <TAG ..> ... </TAG>
// ^- current pointer // ^- current pointer
if( XIsEmptyString(pNode->m_sValue) ) if( XIsEmptyString(pNode->m_Value.m_sValue) )
{ {
// Text Value // Text Value
++iOffset; ++iOffset;
@@ -308,11 +308,11 @@ unsigned XmlFileUtil::Load( XNode *pNode, const RString &xml, RString &sErrorOut
return string::npos; return string::npos;
} }
SetString( xml, iOffset, iEnd, &pNode->m_sValue, true ); SetString( xml, iOffset, iEnd, &pNode->m_Value.m_sValue, true );
iOffset = iEnd; iOffset = iEnd;
// TEXTVALUE reference // TEXTVALUE reference
ReplaceEntityText( pNode->m_sValue, g_mapEntitiesToChars ); ReplaceEntityText( pNode->m_Value.m_sValue, g_mapEntitiesToChars );
} }
// generate child nodes // generate child nodes
@@ -371,7 +371,7 @@ unsigned XmlFileUtil::Load( XNode *pNode, const RString &xml, RString &sErrorOut
} }
else // Alone child Tag Loaded else // Alone child Tag Loaded
{ {
if( XIsEmptyString(pNode->m_sValue) && iOffset < xml.size() && xml[iOffset] != chXMLTagOpen ) if( XIsEmptyString(pNode->m_Value.m_sValue) && iOffset < xml.size() && xml[iOffset] != chXMLTagOpen )
{ {
// Text Value // Text Value
unsigned iEnd = xml.find( chXMLTagOpen, iOffset ); unsigned iEnd = xml.find( chXMLTagOpen, iOffset );
@@ -383,11 +383,11 @@ unsigned XmlFileUtil::Load( XNode *pNode, const RString &xml, RString &sErrorOut
return string::npos; return string::npos;
} }
SetString( xml, iOffset, iEnd, &pNode->m_sValue, true ); SetString( xml, iOffset, iEnd, &pNode->m_Value.m_sValue, true );
iOffset = iEnd; iOffset = iEnd;
//TEXTVALUE //TEXTVALUE
ReplaceEntityText( pNode->m_sValue, g_mapEntitiesToChars ); ReplaceEntityText( pNode->m_Value.m_sValue, g_mapEntitiesToChars );
} }
} }
} }
@@ -423,10 +423,10 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
if( f.Write(" ") == -1 ) if( f.Write(" ") == -1 )
return false; return false;
FOREACH_CONST_Attr( pNode, p ) FOREACH_CONST_Attr( pNode, p )
if( !GetAttrXML(f, p->first, p->second) ) if( !GetAttrXML(f, p->first, p->second.GetValue<RString>()) )
return false; return false;
if( pNode->m_childs.empty() && pNode->m_sValue.empty() ) if( pNode->m_childs.empty() && pNode->m_Value.m_sValue.empty() )
{ {
// <TAG Attr1="Val1"/> alone tag // <TAG Attr1="Val1"/> alone tag
if( f.Write("/>") == -1 ) if( f.Write("/>") == -1 )
@@ -442,11 +442,11 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
iTabBase++; iTabBase++;
FOREACH_CONST_Child( pNode, p ) FOREACH_CONST_Child( pNode, p )
if( !GetXMLInternal( pNode, f, bWriteTabs, iTabBase ) ) if( !GetXMLInternal( p, f, bWriteTabs, iTabBase ) )
return false; return false;
// Text Value // Text Value
if( !pNode->m_sValue.empty() ) if( !pNode->m_Value.m_sValue.empty() )
{ {
if( !pNode->m_childs.empty() ) if( !pNode->m_childs.empty() )
{ {
@@ -457,7 +457,7 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
if( f.Write("\t") == -1 ) if( f.Write("\t") == -1 )
return false; return false;
} }
RString s( pNode->m_sValue ); RString s( pNode->m_Value.m_sValue );
ReplaceEntityText( s, g_mapCharsToEntities ); ReplaceEntityText( s, g_mapCharsToEntities );
if( f.Write(s) == -1 ) if( f.Write(s) == -1 )
return false; return false;