[Project64] get CFile class to use standard types

This commit is contained in:
zilmar 2015-10-25 20:12:53 +11:00
parent 5012979377
commit a2a8eccbca
1 changed files with 62 additions and 66 deletions

View File

@ -1,5 +1,6 @@
#ifndef __FILE_CLASS__H__
#define __FILE_CLASS__H__
#pragma once
#include "stdtypes.h"
class CFileBase
{
@ -30,28 +31,26 @@ public:
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 bool SetLength(ULONG dwNewLen) = 0;
virtual ULONG GetLength() const = 0;
virtual bool SetLength(uint32_t dwNewLen) = 0;
virtual uint32_t GetLength() const = 0;
virtual ULONG Read(void* lpBuf, ULONG nCount) = 0;
virtual bool Write(const void* lpBuf, ULONG nCount) = 0;
virtual uint32_t Read(void* lpBuf, uint32_t nCount) = 0;
virtual bool Write(const void* lpBuf, uint32_t nCount) = 0;
virtual bool Flush() = 0;
virtual bool Close() = 0;
virtual bool IsOpen() const = 0;
virtual bool SetEndOfFile() = 0;
};
class CFile : public CFileBase
{
// Attributes
HANDLE m_hFile;
void * m_hFile;
bool m_bCloseOnDelete;
public:
@ -59,32 +58,29 @@ public:
// Constructors
CFile();
CFile(HANDLE hFile);
CFile(LPCTSTR lpszFileName, ULONG nOpenFlags);
CFile(void * hFile);
CFile(const char * lpszFileName, uint32_t nOpenFlags);
// Deconstructors
virtual ~CFile();
// 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 );
// Overridables
virtual ULONG GetPosition() const;
virtual uint32_t GetPosition() const;
virtual long Seek(long lOff, SeekPosition nFrom);
virtual bool SetLength(ULONG dwNewLen);
virtual ULONG GetLength() const;
virtual bool SetLength(uint32_t dwNewLen);
virtual uint32_t GetLength() const;
virtual ULONG Read(void* lpBuf, ULONG nCount);
virtual bool Write(const void* lpBuf, ULONG nCount);
virtual uint32_t Read(void* lpBuf, uint32_t nCount);
virtual bool Write(const void* lpBuf, uint32_t nCount);
virtual bool Flush();
virtual bool Close();
virtual bool IsOpen() const;
virtual bool SetEndOfFile();
};
#endif