covariant Copy()

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