Move class definition to header.
This commit is contained in:
@@ -34,43 +34,6 @@ static struct FileDriverEntry_DIRRO: public FileDriverEntry
|
||||
RageFileDriver *Create( const RString &sRoot ) const { return new RageFileDriverDirectReadOnly( sRoot ); }
|
||||
} const g_RegisterDriver2;
|
||||
|
||||
/* This driver handles direct file access. */
|
||||
|
||||
class RageFileObjDirect: public RageFileObj
|
||||
{
|
||||
public:
|
||||
RageFileObjDirect( const RString &sPath, int iFD, int iMode );
|
||||
virtual ~RageFileObjDirect();
|
||||
virtual int ReadInternal( void *pBuffer, size_t iBytes );
|
||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes );
|
||||
virtual int FlushInternal();
|
||||
virtual int SeekInternal( int offset );
|
||||
virtual RageFileObjDirect *Copy() const;
|
||||
virtual RString GetDisplayPath() const { return m_sPath; }
|
||||
virtual int GetFileSize() const;
|
||||
virtual int GetFD();
|
||||
|
||||
private:
|
||||
bool FinalFlush();
|
||||
|
||||
int m_iFD;
|
||||
int m_iMode;
|
||||
RString m_sPath; /* for Copy */
|
||||
|
||||
/*
|
||||
* When not streaming to disk, we write to a temporary file, and rename to the
|
||||
* real file on completion. If any write, this is aborted. When streaming to
|
||||
* disk, allow recovering from errors.
|
||||
*/
|
||||
bool m_bWriteFailed;
|
||||
bool WriteFailed() const { return !(m_iMode & RageFile::STREAMED) && m_bWriteFailed; }
|
||||
|
||||
// unused
|
||||
RageFileObjDirect& operator=(const RageFileObjDirect& rhs);
|
||||
RageFileObjDirect(const RageFileObjDirect& rhs);
|
||||
};
|
||||
|
||||
|
||||
RageFileDriverDirect::RageFileDriverDirect( const RString &sRoot ):
|
||||
RageFileDriver( new DirectFilenameDB(sRoot) )
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* RageFileDriverDirect - File driver for accessing a regular filesystem. */
|
||||
|
||||
#ifndef RAGE_FILE_DRIVER_DIRECT_H
|
||||
#define RAGE_FILE_DRIVER_DIRECT_H
|
||||
|
||||
#include "RageFile.h"
|
||||
#include "RageFileDriver.h"
|
||||
|
||||
/** @brief File driver for accessing a regular filesystem. */
|
||||
class RageFileDriverDirect: public RageFileDriver
|
||||
{
|
||||
public:
|
||||
@@ -28,6 +28,43 @@ public:
|
||||
bool Remove( const RString &sPath );
|
||||
};
|
||||
|
||||
/** @brief This driver handles direct file access. */
|
||||
|
||||
class RageFileObjDirect: public RageFileObj
|
||||
{
|
||||
public:
|
||||
RageFileObjDirect( const RString &sPath, int iFD, int iMode );
|
||||
virtual ~RageFileObjDirect();
|
||||
virtual int ReadInternal( void *pBuffer, size_t iBytes );
|
||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes );
|
||||
virtual int FlushInternal();
|
||||
virtual int SeekInternal( int offset );
|
||||
virtual RageFileObjDirect *Copy() const;
|
||||
virtual RString GetDisplayPath() const { return m_sPath; }
|
||||
virtual int GetFileSize() const;
|
||||
virtual int GetFD();
|
||||
|
||||
private:
|
||||
bool FinalFlush();
|
||||
|
||||
int m_iFD;
|
||||
int m_iMode;
|
||||
RString m_sPath; /* for Copy */
|
||||
|
||||
/*
|
||||
* When not streaming to disk, we write to a temporary file, and rename to the
|
||||
* real file on completion. If any write, this is aborted. When streaming to
|
||||
* disk, allow recovering from errors.
|
||||
*/
|
||||
bool m_bWriteFailed;
|
||||
bool WriteFailed() const { return !(m_iMode & RageFile::STREAMED) && m_bWriteFailed; }
|
||||
|
||||
// unused
|
||||
RageFileObjDirect& operator=(const RageFileObjDirect& rhs);
|
||||
RageFileObjDirect(const RageFileObjDirect& rhs);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user