diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp index 35b1d882f0..698de8ebcd 100644 --- a/stepmania/src/XmlFile.cpp +++ b/stepmania/src/XmlFile.cpp @@ -479,7 +479,7 @@ char* XNode::Load( const char* pszXml, PARSEINFO *pi /*= &piDefault*/ ) // Coder Date Desc // bro 2002-10-29 //======================================================== -bool XAttr::GetXML( RageFile &f, DISP_OPT *opt /*= &optDefault*/ ) +bool XAttr::GetXML( RageFileBasic &f, DISP_OPT *opt /*= &optDefault*/ ) { return f.Write(name + "='" + (opt->reference_value&&opt->entitys?opt->entitys->Entity2Ref(value):value) + "' ") != -1; } @@ -493,7 +493,7 @@ bool XAttr::GetXML( RageFile &f, DISP_OPT *opt /*= &optDefault*/ ) // Coder Date Desc // bro 2002-10-29 //======================================================== -bool XNode::GetXML( RageFile &f, DISP_OPT *opt /*= &optDefault*/ ) +bool XNode::GetXML( RageFileBasic &f, DISP_OPT *opt /*= &optDefault*/ ) { // tab if( opt && opt->newline ) @@ -1211,14 +1211,8 @@ bool XNode::LoadFromFile( CString sFile, PARSEINFO *pi ) return true; } -bool XNode::SaveToFile( CString sFile, DISP_OPT *opt ) +bool XNode::SaveToFile( RageFileBasic &f, DISP_OPT *opt ) { - RageFile f; - if( !f.Open(sFile, RageFile::WRITE) ) - { - LOG->Warn("Couldn't open %s for writing: %s", sFile.c_str(), f.GetError().c_str() ); - return false; - } f.PutLine( "" ); if( !opt->stylesheet.empty() ) f.PutLine( "stylesheet + "\"?>" ); @@ -1229,6 +1223,18 @@ bool XNode::SaveToFile( CString sFile, DISP_OPT *opt ) return true; } +bool XNode::SaveToFile( CString sFile, DISP_OPT *opt ) +{ + RageFile f; + if( !f.Open(sFile, RageFile::WRITE) ) + { + LOG->Warn("Couldn't open %s for writing: %s", sFile.c_str(), f.GetError().c_str() ); + return false; + } + + return SaveToFile( f, opt ); +} + bool XIsEmptyString( const char* str ) { CString s(str); diff --git a/stepmania/src/XmlFile.h b/stepmania/src/XmlFile.h index 11dc464883..f4ff123ebe 100644 --- a/stepmania/src/XmlFile.h +++ b/stepmania/src/XmlFile.h @@ -21,7 +21,7 @@ #include struct DateTime; -class RageFile; +class RageFileBasic; struct XAttr; typedef std::vector XAttrs; @@ -117,7 +117,7 @@ struct XAttr XNode* parent; - bool GetXML( RageFile &f, DISP_OPT *opt = &optDefault ); + bool GetXML( RageFileBasic &f, DISP_OPT *opt = &optDefault ); }; // XMLNode structure @@ -146,10 +146,11 @@ struct XNode // Load/Save XML char* Load( const char* pszXml, PARSEINFO *pi = &piDefault ); char* LoadAttributes( const char* pszAttrs, PARSEINFO *pi = &piDefault ); - bool GetXML( RageFile &f, DISP_OPT *opt = &optDefault ); + bool GetXML( RageFileBasic &f, DISP_OPT *opt = &optDefault ); bool LoadFromFile( CString sFile, PARSEINFO *pi = &piDefault ); bool SaveToFile( CString sFile, DISP_OPT *opt = &optDefault ); + bool SaveToFile( RageFileBasic &f, DISP_OPT *opt = &optDefault ); // in own attribute list const XAttr *GetAttr( const char* attrname ) const;