From 4525a2cf86e08c3acad96352aec4deee5150a9a6 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 24 Jul 2011 23:02:14 -0400 Subject: [PATCH] Move class definition to header. --- src/RageFileDriverDirect.cpp | 37 -------------------------------- src/RageFileDriverDirect.h | 41 ++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/RageFileDriverDirect.cpp b/src/RageFileDriverDirect.cpp index 2dfbee3f7d..fffdf3d168 100644 --- a/src/RageFileDriverDirect.cpp +++ b/src/RageFileDriverDirect.cpp @@ -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) ) { diff --git a/src/RageFileDriverDirect.h b/src/RageFileDriverDirect.h index d88813b848..c0f8360743 100644 --- a/src/RageFileDriverDirect.h +++ b/src/RageFileDriverDirect.h @@ -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 /*