summaryrefslogtreecommitdiff
path: root/src/T2DLL/CResFile.h
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-14 00:50:34 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-14 00:50:34 +0100
commit37e364b2c6cc7487a1c888d256a73e5337bb7189 (patch)
treeeaf6e857382eef16c2dd940eb4125536fbe068bd /src/T2DLL/CResFile.h
downloadt2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.tar.gz
t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.zip
initial commit
Diffstat (limited to '')
-rw-r--r--src/T2DLL/CResFile.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/T2DLL/CResFile.h b/src/T2DLL/CResFile.h
new file mode 100644
index 0000000..5c10f21
--- /dev/null
+++ b/src/T2DLL/CResFile.h
@@ -0,0 +1,50 @@
+#pragma once
+#include "common.h"
+
+class DLL_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;
+};