RageFileBasic
This commit is contained in:
@@ -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( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" );
|
||||
if( !opt->stylesheet.empty() )
|
||||
f.PutLine( "<?xml-stylesheet type=\"text/xsl\" href=\"" + opt->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);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <vector>
|
||||
struct DateTime;
|
||||
class RageFile;
|
||||
class RageFileBasic;
|
||||
|
||||
struct XAttr;
|
||||
typedef std::vector<XAttr*> 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;
|
||||
|
||||
Reference in New Issue
Block a user