covariant Copy()
This commit is contained in:
@@ -25,7 +25,7 @@ RageFile::RageFile( const RageFile &cpy ):
|
||||
m_Mode = cpy.m_Mode;
|
||||
}
|
||||
|
||||
RageFileBasic *RageFile::Copy() const
|
||||
RageFile *RageFile::Copy() const
|
||||
{
|
||||
return new RageFile( *this );
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
RageFile();
|
||||
~RageFile() { Close(); }
|
||||
RageFile( const RageFile &cpy );
|
||||
RageFileBasic *Copy() const;
|
||||
RageFile *Copy() const;
|
||||
|
||||
/*
|
||||
* Use GetRealPath to get the path this file was opened with; use that if you
|
||||
|
||||
@@ -63,7 +63,7 @@ RageFileObjInflate::RageFileObjInflate( const RageFileObjInflate &cpy ):
|
||||
*/
|
||||
}
|
||||
|
||||
RageFileBasic *RageFileObjInflate::Copy() const
|
||||
RageFileObjInflate *RageFileObjInflate::Copy() const
|
||||
{
|
||||
RageException::Throw( "Loading ZIPs from deflated ZIPs is currently disabled; see RageFileObjInflate." );
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
int WriteInternal( const void *pBuffer, size_t iBytes ) { SetError( "Not implemented" ); return -1; }
|
||||
int SeekInternal( int iOffset );
|
||||
int GetFileSize() const { return m_iUncompressedSize; }
|
||||
RageFileBasic *Copy() const;
|
||||
RageFileObjInflate *Copy() const;
|
||||
|
||||
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes );
|
||||
virtual int FlushInternal();
|
||||
virtual int SeekInternal( int offset );
|
||||
virtual RageFileBasic *Copy() const;
|
||||
virtual RageFileObjDirect *Copy() const;
|
||||
virtual RString GetDisplayPath() const { return m_sPath; }
|
||||
virtual int GetFileSize() const;
|
||||
|
||||
@@ -76,7 +76,7 @@ static RString MakeTempFilename( const RString &sPath )
|
||||
return Dirname(sPath) + "new." + Basename(sPath) + ".new";
|
||||
}
|
||||
|
||||
RageFileObj *MakeFileObjDirect( RString sPath, int iMode, int &iError )
|
||||
RageFileObjDirect *MakeFileObjDirect( RString sPath, int iMode, int &iError )
|
||||
{
|
||||
int iFD;
|
||||
if( iMode & RageFile::READ )
|
||||
@@ -184,10 +184,10 @@ bool RageFileDriverDirect::Remove( const RString &sPath_ )
|
||||
}
|
||||
}
|
||||
|
||||
RageFileBasic *RageFileObjDirect::Copy() const
|
||||
RageFileObjDirect *RageFileObjDirect::Copy() const
|
||||
{
|
||||
int iErr;
|
||||
RageFileObj *ret = MakeFileObjDirect( m_sPath, m_iMode, iErr );
|
||||
RageFileObjDirect *ret = MakeFileObjDirect( m_sPath, m_iMode, iErr );
|
||||
|
||||
if( ret == NULL )
|
||||
RageException::Throw( "Couldn't reopen \"%s\": %s", m_sPath.c_str(), strerror(iErr) );
|
||||
|
||||
@@ -92,7 +92,7 @@ RageFileObjMem::RageFileObjMem( const RageFileObjMem &cpy ):
|
||||
RageFileObjMemFile::AddReference( m_pFile );
|
||||
}
|
||||
|
||||
RageFileBasic *RageFileObjMem::Copy() const
|
||||
RageFileObjMem *RageFileObjMem::Copy() const
|
||||
{
|
||||
RageFileObjMem *pRet = new RageFileObjMem( *this );
|
||||
return pRet;
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
int WriteInternal( const void *buffer, size_t bytes );
|
||||
int SeekInternal( int offset );
|
||||
int GetFileSize() const;
|
||||
RageFileBasic *Copy() const;
|
||||
RageFileObjMem *Copy() const;
|
||||
|
||||
/* Retrieve the contents of this file. */
|
||||
const RString &GetString() const;
|
||||
|
||||
@@ -26,7 +26,7 @@ RageFileDriverSlice::~RageFileDriverSlice()
|
||||
delete m_pFile;
|
||||
}
|
||||
|
||||
RageFileBasic *RageFileDriverSlice::Copy() const
|
||||
RageFileDriverSlice *RageFileDriverSlice::Copy() const
|
||||
{
|
||||
RageFileDriverSlice *pRet = new RageFileDriverSlice( *this );
|
||||
return pRet;
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
RageFileDriverSlice( RageFileBasic *pFile, int iOffset, int iFileSize );
|
||||
RageFileDriverSlice( const RageFileDriverSlice &cpy );
|
||||
~RageFileDriverSlice();
|
||||
RageFileBasic *Copy() const;
|
||||
RageFileDriverSlice *Copy() const;
|
||||
|
||||
void DeleteFileWhenFinished() { m_bFileOwned = true; }
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ RageSoundReader_Chain::~RageSoundReader_Chain()
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
SoundReader *RageSoundReader_Chain::Copy() const
|
||||
RageSoundReader_Chain *RageSoundReader_Chain::Copy() const
|
||||
{
|
||||
// XXX
|
||||
FAIL_M("unimplemented");
|
||||
|
||||
@@ -13,7 +13,7 @@ class RageSoundReader_Chain: public SoundReader
|
||||
public:
|
||||
RageSoundReader_Chain();
|
||||
~RageSoundReader_Chain();
|
||||
SoundReader *Copy() const;
|
||||
RageSoundReader_Chain *Copy() const;
|
||||
|
||||
/* Set the preferred sample rate. This will only be used if the source sounds
|
||||
* use different sample rates. */
|
||||
|
||||
@@ -676,7 +676,7 @@ SoundReader_FileReader::OpenResult RageSoundReader_MP3::Open( RString filename_
|
||||
}
|
||||
|
||||
|
||||
SoundReader *RageSoundReader_MP3::Copy() const
|
||||
RageSoundReader_MP3 *RageSoundReader_MP3::Copy() const
|
||||
{
|
||||
RageSoundReader_MP3 *ret = new RageSoundReader_MP3;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
RageSoundReader_MP3();
|
||||
~RageSoundReader_MP3();
|
||||
RageSoundReader_MP3( const RageSoundReader_MP3 & ); /* not defined; don't use */
|
||||
SoundReader *Copy() const;
|
||||
RageSoundReader_MP3 *Copy() const;
|
||||
|
||||
private:
|
||||
int SampleRate;
|
||||
|
||||
@@ -112,7 +112,7 @@ int RageSoundReader_Preload::Read(char *buffer, unsigned len)
|
||||
return len;
|
||||
}
|
||||
|
||||
SoundReader *RageSoundReader_Preload::Copy() const
|
||||
RageSoundReader_Preload *RageSoundReader_Preload::Copy() const
|
||||
{
|
||||
return new RageSoundReader_Preload(*this);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
* this is the last copy.) */
|
||||
int GetReferenceCount() const;
|
||||
|
||||
SoundReader *Copy() const;
|
||||
RageSoundReader_Preload *Copy() const;
|
||||
~RageSoundReader_Preload() { }
|
||||
|
||||
/* Attempt to preload a sound. pSound must be rewound. */
|
||||
|
||||
@@ -619,7 +619,7 @@ int RageSoundReader_Resample_Good::Read( char *bufp, unsigned len )
|
||||
return iFramesRead * iBytesPerFrame;
|
||||
}
|
||||
|
||||
SoundReader *RageSoundReader_Resample_Good::Copy() const
|
||||
RageSoundReader_Resample_Good *RageSoundReader_Resample_Good::Copy() const
|
||||
{
|
||||
SoundReader *pSource = m_pSource->Copy();
|
||||
RageSoundReader_Resample_Good *ret = new RageSoundReader_Resample_Good;
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
int Read(char *buf, unsigned len);
|
||||
RageSoundReader_Resample_Good();
|
||||
virtual ~RageSoundReader_Resample_Good();
|
||||
SoundReader *Copy() const;
|
||||
RageSoundReader_Resample_Good *Copy() const;
|
||||
|
||||
/* Change the actual sample rate of a sound. */
|
||||
void SetSampleRate( int hz );
|
||||
|
||||
@@ -267,7 +267,7 @@ RageSoundReader_Vorbisfile::~RageSoundReader_Vorbisfile()
|
||||
delete vf;
|
||||
}
|
||||
|
||||
SoundReader *RageSoundReader_Vorbisfile::Copy() const
|
||||
RageSoundReader_Vorbisfile *RageSoundReader_Vorbisfile::Copy() const
|
||||
{
|
||||
const RageFileBasic *pFrom = (RageFileBasic *) vf->datasource;
|
||||
RageFileBasic *pFile = pFrom->Copy();
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
unsigned GetNumChannels() const { return channels; }
|
||||
RageSoundReader_Vorbisfile();
|
||||
~RageSoundReader_Vorbisfile();
|
||||
SoundReader *Copy() const;
|
||||
RageSoundReader_Vorbisfile *Copy() const;
|
||||
|
||||
private:
|
||||
OggVorbis_File *vf;
|
||||
|
||||
@@ -516,7 +516,7 @@ RageSoundReader_WAV::~RageSoundReader_WAV()
|
||||
delete m_pImpl;
|
||||
}
|
||||
|
||||
SoundReader *RageSoundReader_WAV::Copy() const
|
||||
RageSoundReader_WAV *RageSoundReader_WAV::Copy() const
|
||||
{
|
||||
RageSoundReader_WAV *ret = new RageSoundReader_WAV;
|
||||
ret->Open( m_sFilename );
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
RageSoundReader_WAV();
|
||||
~RageSoundReader_WAV();
|
||||
RageSoundReader_WAV( const RageSoundReader_WAV & ); /* not defined; don't use */
|
||||
SoundReader *Copy() const;
|
||||
RageSoundReader_WAV *Copy() const;
|
||||
|
||||
struct WavData
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user