allow passing a file directly to IniFile
This commit is contained in:
@@ -17,6 +17,11 @@ bool IniFile::ReadFile( const CString &sPath )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ReadFile( f );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IniFile::ReadFile( RageBasicFile &f )
|
||||||
|
{
|
||||||
CString keyname;
|
CString keyname;
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
@@ -66,9 +71,14 @@ bool IniFile::WriteFile( const CString &sPath )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return IniFile::WriteFile( f );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IniFile::WriteFile( RageBasicFile &f )
|
||||||
|
{
|
||||||
for( keymap::const_iterator k = keys.begin(); k != keys.end(); ++k )
|
for( keymap::const_iterator k = keys.begin(); k != keys.end(); ++k )
|
||||||
{
|
{
|
||||||
if (k->second.empty())
|
if( k->second.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( f.PutLine( ssprintf("[%s]", k->first.c_str()) ) == -1 )
|
if( f.PutLine( ssprintf("[%s]", k->first.c_str()) ) == -1 )
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
class RageBasicFile;
|
||||||
|
|
||||||
class IniFile
|
class IniFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -35,7 +37,9 @@ public:
|
|||||||
const CString &GetError() const { return m_sError; }
|
const CString &GetError() const { return m_sError; }
|
||||||
|
|
||||||
bool ReadFile( const CString &sPath );
|
bool ReadFile( const CString &sPath );
|
||||||
|
bool ReadFile( RageBasicFile &sFile );
|
||||||
bool WriteFile( const CString &sPath );
|
bool WriteFile( const CString &sPath );
|
||||||
|
bool WriteFile( RageBasicFile &sFile );
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
int GetNumKeys() const;
|
int GetNumKeys() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user