[Project64] get CFile class to use standard types
This commit is contained in:
parent
5012979377
commit
a2a8eccbca
|
@ -1,5 +1,6 @@
|
||||||
#ifndef __FILE_CLASS__H__
|
#pragma once
|
||||||
#define __FILE_CLASS__H__
|
|
||||||
|
#include "stdtypes.h"
|
||||||
|
|
||||||
class CFileBase
|
class CFileBase
|
||||||
{
|
{
|
||||||
|
@ -30,61 +31,56 @@ public:
|
||||||
|
|
||||||
enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
|
enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
|
||||||
|
|
||||||
virtual bool Open(LPCTSTR lpszFileName, ULONG nOpenFlags ) = 0;
|
virtual bool Open(const char * lpszFileName, uint32_t nOpenFlags ) = 0;
|
||||||
|
|
||||||
virtual ULONG GetPosition() const = 0;
|
virtual uint32_t GetPosition() const = 0;
|
||||||
virtual long Seek(long lOff, SeekPosition nFrom) = 0;
|
virtual long Seek(long lOff, SeekPosition nFrom) = 0;
|
||||||
virtual bool SetLength(ULONG dwNewLen) = 0;
|
virtual bool SetLength(uint32_t dwNewLen) = 0;
|
||||||
virtual ULONG GetLength() const = 0;
|
virtual uint32_t GetLength() const = 0;
|
||||||
|
|
||||||
virtual ULONG Read(void* lpBuf, ULONG nCount) = 0;
|
virtual uint32_t Read(void* lpBuf, uint32_t nCount) = 0;
|
||||||
virtual bool Write(const void* lpBuf, ULONG nCount) = 0;
|
virtual bool Write(const void* lpBuf, uint32_t nCount) = 0;
|
||||||
|
|
||||||
virtual bool Flush() = 0;
|
virtual bool Flush() = 0;
|
||||||
virtual bool Close() = 0;
|
virtual bool Close() = 0;
|
||||||
virtual bool IsOpen() const = 0;
|
virtual bool IsOpen() const = 0;
|
||||||
virtual bool SetEndOfFile() = 0;
|
virtual bool SetEndOfFile() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CFile : public CFileBase
|
class CFile : public CFileBase
|
||||||
{
|
{
|
||||||
|
// Attributes
|
||||||
// Attributes
|
void * m_hFile;
|
||||||
HANDLE m_hFile;
|
|
||||||
bool m_bCloseOnDelete;
|
bool m_bCloseOnDelete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Flag values
|
// Flag values
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
CFile();
|
CFile();
|
||||||
CFile(HANDLE hFile);
|
CFile(void * hFile);
|
||||||
CFile(LPCTSTR lpszFileName, ULONG nOpenFlags);
|
CFile(const char * lpszFileName, uint32_t nOpenFlags);
|
||||||
|
|
||||||
// Deconstructors
|
// Deconstructors
|
||||||
virtual ~CFile();
|
virtual ~CFile();
|
||||||
|
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
virtual bool Open(LPCTSTR lpszFileName, ULONG nOpenFlags );
|
virtual bool Open(const char * lpszFileName, uint32_t nOpenFlags );
|
||||||
|
|
||||||
ULONG SeekToEnd ( void );
|
uint32_t SeekToEnd ( void );
|
||||||
void SeekToBegin ( void );
|
void SeekToBegin ( void );
|
||||||
|
|
||||||
// Overridables
|
// Overridables
|
||||||
virtual ULONG GetPosition() const;
|
virtual uint32_t GetPosition() const;
|
||||||
virtual long Seek(long lOff, SeekPosition nFrom);
|
virtual long Seek(long lOff, SeekPosition nFrom);
|
||||||
virtual bool SetLength(ULONG dwNewLen);
|
virtual bool SetLength(uint32_t dwNewLen);
|
||||||
virtual ULONG GetLength() const;
|
virtual uint32_t GetLength() const;
|
||||||
|
|
||||||
virtual ULONG Read(void* lpBuf, ULONG nCount);
|
virtual uint32_t Read(void* lpBuf, uint32_t nCount);
|
||||||
virtual bool Write(const void* lpBuf, ULONG nCount);
|
virtual bool Write(const void* lpBuf, uint32_t nCount);
|
||||||
|
|
||||||
virtual bool Flush();
|
virtual bool Flush();
|
||||||
virtual bool Close();
|
virtual bool Close();
|
||||||
virtual bool IsOpen() const;
|
virtual bool IsOpen() const;
|
||||||
virtual bool SetEndOfFile();
|
virtual bool SetEndOfFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue