summaryrefslogtreecommitdiff
path: root/src/T2DLL/CResFile.h
blob: 020f3996b30cf208aeccbf12f9082a20902fbed3 (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
#ifndef T2DLL_CRESFILE_H
#define T2DLL_CRESFILE_H
#include "../common.h"

class AFX_CLASS_EXPORT CResFile {
public:
	CResFile();
	virtual ~CResFile();
	BOOL OpenResource(HINSTANCE inst, int name, int type);
	BOOL OpenResource(HINSTANCE inst, const char* name, int type);
	BOOL OpenResource(HINSTANCE inst, int name, const char* type);
	BOOL OpenResource(HINSTANCE inst, const char* name, const char* type);
	BOOL OpenResource(HINSTANCE inst, HRSRC rsrc);
	BOOL OpenResource(const char* path, int name, int type);
protected:
	void SetupResource();
	void Reset();
	BOOL Token(char* outStr);
public:
	BOOL operator>>(unsigned char& out);
	BOOL operator>>(int& out);
	BOOL operator>>(short& out);
	BOOL operator>>(long& out);
	BOOL operator>>(unsigned int& out);
	BOOL operator>>(unsigned long& out);
	BOOL operator>>(unsigned short& out);
	BOOL operator>>(POINT& outPoint);
	BOOL operator>>(RECT& outRect);
	BOOL operator>>(SIZE& outSize);
	BOOL operator>>(char* outStr);
	BOOL operator>>(CString& outStr);
	void SkipDescriptor();
	void End();

	void GetResourceInfo(HINSTANCE* outInstance, HRSRC* outRsrc) const {
		*outInstance = mInstance;
		*outRsrc = mRsrc;
	}

	BOOL IsBinaryMode() const { return mIsBinaryMode; }
	BOOL IsSubPlugin() const { return mIsSubPlugin; }

private:
	BOOL mIsBinaryMode;
	HINSTANCE mInstance;
	HRSRC mRsrc;
	char *mBuffer;
	char *mPos;
	unsigned int mRemaining;
	BOOL mIsSubPlugin;
};
#endif