sourcehook/test/sourcehook_test.h
author Scott Ehlert <ds@alliedmods.net>
Tue Sep 16 04:41:32 2008 -0500 (2008-09-16)
changeset 533 591b88a78e35
parent 480 d096210677d4
permissions -rw-r--r--
Fixed tags for mmsource-central

mmsource-1.00-RC1 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:41:34 2006 UTC
mmsource-1.00-RC2 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:35:20 2006 UTC
mmsource-1.00 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:30:40 2006 UTC
mmsource-1.1 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:25:09 2006 UTC
mmsource-1.1.1 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:22:23 2006 UTC
mmsource-1.1.2 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:14:00 2006 UTC
mmsource-1.2 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:10:47 2006 UTC
mmsource-1.2.1 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 08:01:35 2006 UTC
mmsource-1.2.2 - Not tagged originally, but eventually done by Scott Ehlert <[email protected]> on Wed Jul 19 07:57:26 2006 UTC
mmsource-1.2.3 - Not tagged originally, but eventually done by David Anderson <[email protected]> on Wed Jul 12 17:33:59 2006 UTC
mmsource-1.3 - Originally tagged by Scott Ehlert <[email protected]> on Thu Aug 17 03:19:55 2006 UTC
mmsource-1.3a - Originally tagged by Scott Ehlert <[email protected]> on Wed Sep 6 07:17:37 2006 UTC
mmsource-1.3d - Originally tagged by Scott Ehlert <[email protected]> on Fri Feb 2 05:30:56 2007 UTC
mmsource-1.4 - Originally tagged by Scott Ehlert <[email protected]> on Sat Apr 7 05:00:28 2007 UTC
mmsource-1.6.0 - Originally tagged by David Anderson <[email protected]> on Mon Feb 18 23:31:29 2008 UTC
mmsource-1.6.1 - Originally tagged by David Anderson <[email protected]> on Mon Feb 25 17:15:44 2008 UTC
mmsource-1.6.2 - Originally tagged by David Anderson <[email protected]> on Sat Jul 26 05:04:35 2008 UTC
     1 // This file is used for backwards compatibility testing
     2 // It allows us to test binary backwards compatibility by using an older include file HERE:
     3 #include "sourcehook.h"			// <-- here
     4 // There. main.cpp which implements all of the following function is always usign sourcehook.h
     5 // and the up-to-date sourcehook_impl.h/sourcehook.cpp. The tests use this file however.
     6 // If the test needs an up-to-date version (like the recall test), it can simply
     7 // #include "sourcehook.h" before including this, thus overriding our decision.
     8 
     9 
    10 SourceHook::ISourceHook *Test_Factory();
    11 void Test_Delete(SourceHook::ISourceHook *shptr);
    12 
    13 template <class T>
    14 struct CAutoPtrDestruction
    15 {
    16 	T *m_Ptr;
    17 	CAutoPtrDestruction(T *p) : m_Ptr(p) { }
    18 	~CAutoPtrDestruction() { if (m_Ptr) delete m_Ptr; }
    19 	void clear() { m_Ptr = NULL; }
    20 	void set(T *ptr) { m_Ptr = ptr; }
    21 };
    22 
    23 struct CSHPtrAutoDestruction
    24 {
    25 	SourceHook::ISourceHook *m_SHPtr;
    26 	CSHPtrAutoDestruction(SourceHook::ISourceHook *shptr) : m_SHPtr(shptr) {}
    27 	~CSHPtrAutoDestruction() { Test_Delete(m_SHPtr); }
    28 };
    29 
    30 #define GET_SHPTR(var) var = Test_Factory(); CSHPtrAutoDestruction ___autodestruction(var);
    31 
    32 // Access to CSourceHookImpl functions
    33 void Test_CompleteShutdown(SourceHook::ISourceHook *shptr);
    34 void Test_UnloadPlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
    35 void Test_PausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
    36 void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
    37 
    38 SourceHook::IHookManagerAutoGen *Test_HMAG_Factory(SourceHook::ISourceHook *pSHPtr);
    39 void Test_HMAG_Delete(SourceHook::IHookManagerAutoGen *ptr);
    40 
    41 struct CHMAGAutoDestruction
    42 {
    43 	SourceHook::IHookManagerAutoGen *m_Ptr;
    44 	CHMAGAutoDestruction(SourceHook::IHookManagerAutoGen *ptr) : m_Ptr(ptr) {}
    45 	~CHMAGAutoDestruction() { Test_HMAG_Delete(m_Ptr); }
    46 };
    47 
    48 
    49 #define GET_HMAG(var, shptr) var = Test_HMAG_Factory(shptr); CHMAGAutoDestruction __hmagautodestruction(var);