dolphin/Source/Plugins/Plugin_VideoDX9/Src/W32Util/File.h
bushing 30c883bcfc set svn:eol-style=native for **.h
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
2008-12-08 04:46:09 +00:00

61 lines
1.1 KiB
C++

#ifndef __LAMEFILE_H__
#define __LAMEFILE_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
namespace W32Util
{
enum eFileMode
{
FILE_READ=5,
FILE_WRITE=6,
FILE_ERROR=0xff
};
class File
{
HANDLE fileHandle;
eFileMode mode;
bool isOpen;
public:
File();
virtual ~File();
bool Open(const TCHAR *filename, eFileMode mode);
void Adopt(HANDLE h) { fileHandle = h;}
void Close();
void WriteInt(int i);
void WriteChar(char i);
int Write(void *data, int size);
int ReadInt();
char ReadChar();
int Read(void *data, int size);
int WR(void *data, int size); //write or read depending on open mode
bool MagicCookie(int cookie);
int GetSize();
eFileMode GetMode() {return mode;}
void SeekBeg(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
}
void SeekEnd(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
}
void SeekCurrent(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
}
};
}
#endif //__LAMEFILE_H__