sourcehook/test/sourcehook_test.h
changeset 480 d096210677d4
parent 404 75808639f384
     1.1 --- a/sourcehook/test/sourcehook_test.h	Sat Nov 24 06:11:23 2007 +0000
     1.2 +++ b/sourcehook/test/sourcehook_test.h	Mon Nov 26 14:03:25 2007 +0000
     1.3 @@ -17,6 +17,7 @@
     1.4  	CAutoPtrDestruction(T *p) : m_Ptr(p) { }
     1.5  	~CAutoPtrDestruction() { if (m_Ptr) delete m_Ptr; }
     1.6  	void clear() { m_Ptr = NULL; }
     1.7 +	void set(T *ptr) { m_Ptr = ptr; }
     1.8  };
     1.9  
    1.10  struct CSHPtrAutoDestruction
    1.11 @@ -33,3 +34,16 @@
    1.12  void Test_UnloadPlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
    1.13  void Test_PausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
    1.14  void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
    1.15 +
    1.16 +SourceHook::IHookManagerAutoGen *Test_HMAG_Factory(SourceHook::ISourceHook *pSHPtr);
    1.17 +void Test_HMAG_Delete(SourceHook::IHookManagerAutoGen *ptr);
    1.18 +
    1.19 +struct CHMAGAutoDestruction
    1.20 +{
    1.21 +	SourceHook::IHookManagerAutoGen *m_Ptr;
    1.22 +	CHMAGAutoDestruction(SourceHook::IHookManagerAutoGen *ptr) : m_Ptr(ptr) {}
    1.23 +	~CHMAGAutoDestruction() { Test_HMAG_Delete(m_Ptr); }
    1.24 +};
    1.25 +
    1.26 +
    1.27 +#define GET_HMAG(var, shptr) var = Test_HMAG_Factory(shptr); CHMAGAutoDestruction __hmagautodestruction(var);