Simplify.

This commit is contained in:
Steve Checkoway
2006-10-01 14:02:24 +00:00
parent f73100705b
commit b7ce93ffad
5 changed files with 11 additions and 24 deletions
+1 -1
View File
@@ -392,7 +392,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
xml.AppendChild( "FooterText", FOOTER_TEXT );
xml.AppendChild( "FooterLink", FOOTER_LINK );
xml.SaveToFile( fn, XMLDisplayOptions(CATALOG_XSL, false) );
xml.SaveToFile( fn, CATALOG_XSL, false );
LOG->Trace( "Done." );
}
+1 -1
View File
@@ -57,7 +57,7 @@ void ExportStrings::LuaInformation()
XNode *pDateNode = pNode->AppendChild( "Date" );
pDateNode->m_sValue = DateTime::GetNowDate().GetString();
pNode->SaveToFile( "Lua.xml", XMLDisplayOptions( "Lua.xsl") );
pNode->SaveToFile( "Lua.xml", "Lua.xsl" );
delete pNode;
}
+1 -1
View File
@@ -940,7 +940,7 @@ bool Profile::SaveStatsXmlToDir( RString sDir, bool bSignData ) const
// Save stats.xml
RString fn = sDir + STATS_XML;
bool bSaved = xml->SaveToFile( fn, XMLDisplayOptions(STATS_XSL, false) );
bool bSaved = xml->SaveToFile( fn, STATS_XSL, false );
SAFE_DELETE( xml );
+6 -6
View File
@@ -602,20 +602,20 @@ void XNode::AppendAttr( const RString &sName, float value ){ AppendAttr(sName,ss
void XNode::AppendAttr( const RString &sName, int value ) { AppendAttr(sName,ssprintf("%d",value)); }
void XNode::AppendAttr( const RString &sName, unsigned value ) { AppendAttr(sName,ssprintf("%u",value)); }
bool XNode::SaveToFile( RageFileBasic &f, const XMLDisplayOptions &opt ) const
bool XNode::SaveToFile( RageFileBasic &f, const RString &sStylesheet, bool bWriteTabs ) const
{
f.PutLine( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" );
if( !opt.m_sStylesheet.empty() )
f.PutLine( "<?xml-stylesheet type=\"text/xsl\" href=\"" + opt.m_sStylesheet + "\"?>" );
if( !sStylesheet.empty() )
f.PutLine( "<?xml-stylesheet type=\"text/xsl\" href=\"" + sStylesheet + "\"?>" );
int iTabBase = 0;
if( !this->GetXMLInternal(f, opt.m_bWriteTabs, iTabBase) )
if( !this->GetXMLInternal(f, bWriteTabs, iTabBase) )
return false;
if( f.Flush() == -1 )
return false;
return true;
}
bool XNode::SaveToFile( const RString &sFile, const XMLDisplayOptions &opt ) const
bool XNode::SaveToFile( const RString &sFile, const RString &sStylesheet, bool bWriteTabs ) const
{
RageFile f;
if( !f.Open(sFile, RageFile::WRITE) )
@@ -624,5 +624,5 @@ bool XNode::SaveToFile( const RString &sFile, const XMLDisplayOptions &opt ) con
return false;
}
return SaveToFile( f, opt );
return SaveToFile( f, sStylesheet, bWriteTabs );
}
+2 -15
View File
@@ -35,19 +35,6 @@ typedef multimap<RString,XNode*> XNodes;
Var##Iter != (pNode)->m_childs.end(); \
++Var##Iter )
// display optional environment
struct XMLDisplayOptions
{
XMLDisplayOptions( const RString &sStylesheet = "", bool bWriteTabs = true )
{
m_sStylesheet = sStylesheet;
m_bWriteTabs = bWriteTabs;
}
RString m_sStylesheet; // empty string = no stylesheet
bool m_bWriteTabs; // if false, don't write tab indent characters
};
// XMLNode structure
class XNode
{
@@ -76,8 +63,8 @@ public:
bool GetXML( RageFileBasic &f, bool bWriteTabs = true ) const;
RString GetXML() const;
bool SaveToFile( const RString &sFile, const XMLDisplayOptions &opt = XMLDisplayOptions() ) const;
bool SaveToFile( RageFileBasic &f, const XMLDisplayOptions &opt = XMLDisplayOptions() ) const;
bool SaveToFile( const RString &sFile, const RString &sStylesheet = "", bool bWriteTabs = true ) const;
bool SaveToFile( RageFileBasic &f, const RString &sStylesheet = "", bool bWriteTabs = true ) const;
// in own attribute list
const RString *GetAttr( const RString &sAttrName ) const;