summaryrefslogtreecommitdiff
path: root/common/file.h
blob: 8608092a5ccf7c35b2d4c6582f82444c17200934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
//	file.h
////////////////////////////////////////////////////

#ifndef _FILE_H_
#define _FILE_H_

#include <stdio.h>

class File
{
public:
// Constructors
	File(bool bMemFile);
	~File();

// Implementation
protected:
	bool m_bMemFile;

	// MemFile specific:
	unsigned long m_nGrowBytes;
	unsigned long m_nPosition;
	unsigned long m_nBufferSize;
	unsigned long m_nFileSize;
	unsigned char* m_pBuffer;
	bool m_bAutoDelete;
	void GrowFile(unsigned long nNewLen);

	// DiscFile specific:
	FILE* m_hFile;
	bool m_bCloseOnDelete;

public:
	unsigned long GetPosition() const;
	unsigned long Seek(long lOff, int nFrom);
	void SetLength(unsigned long nNewLen);
	unsigned long GetLength() const;

	char* ReadString(char* pBuf, unsigned long nMax);
	unsigned long Read(void* pBuf, unsigned long nCount);
	unsigned long Write(const void* pBuf, unsigned long nCount);
	int GetChar();
	int PutChar(int c);

	void Abort();
	void Flush();
	void Close();
	bool Open(const char *filename, const char *mode);

public:
// Attributes
//	CString GetFileName() const;
//	CString GetFileTitle() const;
//	CString GetFilePath() const;
//	void SetFilePath(LPCTSTR lpszNewName);

protected:
//	CString m_strFileName;
};


#endif // _FILE_H_