allow initializing a RageFileSource with a RageFileBasic*
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "CryptHelpers.h"
|
#include "CryptHelpers.h"
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
|
#include "RageLog.h"
|
||||||
|
|
||||||
// crypt headers
|
// crypt headers
|
||||||
#include "crypto51/files.h"
|
#include "crypto51/files.h"
|
||||||
@@ -13,6 +14,13 @@ RageFileStore::ReadErr::ReadErr( const RageFileBasic &f ):
|
|||||||
RageFileStore::RageFileStore()
|
RageFileStore::RageFileStore()
|
||||||
{
|
{
|
||||||
m_pFile = NULL;
|
m_pFile = NULL;
|
||||||
|
m_waiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RageFileStore::RageFileStore( RageFileBasic *pFile )
|
||||||
|
{
|
||||||
|
m_pFile = pFile;
|
||||||
|
m_waiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RageFileStore::~RageFileStore()
|
RageFileStore::~RageFileStore()
|
||||||
@@ -41,12 +49,14 @@ void RageFileStore::StoreInitialize(const NameValuePairs ¶meters)
|
|||||||
{
|
{
|
||||||
RageFile *pFile = new RageFile;
|
RageFile *pFile = new RageFile;
|
||||||
m_pFile = pFile;
|
m_pFile = pFile;
|
||||||
|
LOG->Trace( "XXX: not using pFile" );
|
||||||
if( !pFile->Open(fileName, RageFile::READ) )
|
if( !pFile->Open(fileName, RageFile::READ) )
|
||||||
throw OpenErr( fileName );
|
throw OpenErr( fileName );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
ASSERT( m_pFile != NULL );
|
||||||
|
LOG->Trace( "XXX: using pFile" );
|
||||||
}
|
}
|
||||||
m_waiting = false;
|
m_waiting = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
using namespace CryptoPP;
|
using namespace CryptoPP;
|
||||||
class RageFileBasic;
|
class RageFileBasic;
|
||||||
|
|
||||||
//! .
|
|
||||||
class RageFileStore : public Store, private FilterPutSpaceHelper
|
class RageFileStore : public Store, private FilterPutSpaceHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -22,6 +21,7 @@ public:
|
|||||||
struct ReadErr : public Err { ReadErr( const RageFileBasic &f ); };
|
struct ReadErr : public Err { ReadErr( const RageFileBasic &f ); };
|
||||||
|
|
||||||
RageFileStore();
|
RageFileStore();
|
||||||
|
RageFileStore( RageFileBasic *pFile ); /* pFile will be deleted */
|
||||||
~RageFileStore();
|
~RageFileStore();
|
||||||
RageFileStore( const RageFileStore &cpy );
|
RageFileStore( const RageFileStore &cpy );
|
||||||
RageFileStore(const char *filename)
|
RageFileStore(const char *filename)
|
||||||
@@ -40,7 +40,6 @@ private:
|
|||||||
bool m_waiting;
|
bool m_waiting;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! .
|
|
||||||
class RageFileSource : public SourceTemplate<RageFileStore>
|
class RageFileSource : public SourceTemplate<RageFileStore>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -48,6 +47,8 @@ public:
|
|||||||
typedef FileStore::OpenErr OpenErr;
|
typedef FileStore::OpenErr OpenErr;
|
||||||
typedef FileStore::ReadErr ReadErr;
|
typedef FileStore::ReadErr ReadErr;
|
||||||
|
|
||||||
|
RageFileSource( RageFileBasic *pFile, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true )
|
||||||
|
: SourceTemplate<RageFileStore>(attachment,RageFileStore(pFile)) {SourceInitialize(pumpAll, MakeParameters("InputBinaryMode", binary));}
|
||||||
RageFileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true)
|
RageFileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true)
|
||||||
: SourceTemplate<RageFileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputFileName", filename)("InputBinaryMode", binary));}
|
: SourceTemplate<RageFileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputFileName", filename)("InputBinaryMode", binary));}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user