LEFT | RIGHT |
(no file at all) | |
1 /** | 1 /** |
2 * \file abp_ca.cpp Top-level source for custom actions. Includes DLL initializat
ion. | 2 * \file abp_ca.cpp Top-level source for custom actions. Includes DLL initializat
ion. |
3 */ | 3 */ |
4 #include "DLL.h" | 4 #include "DLL.h" |
5 #include <stdexcept> | 5 #include <stdexcept> |
6 | 6 |
7 std::shared_ptr< DLL_Module > DLL_Module::singleton = 0 ; | 7 std::shared_ptr< DllModule > DllModule::singleton = 0 ; |
8 | 8 |
9 DLL_Module & DLL_Module::module() | 9 DllModule & DllModule::module() |
10 { | 10 { |
11 if ( singleton ) | 11 if ( singleton ) |
12 { | 12 { |
13 return * singleton; | 13 return * singleton; |
14 } | 14 } |
15 throw std::runtime_error( "DLL_Module::module() called when DLL module was not
attached." ); | 15 throw std::runtime_error( "DllModule::module() called when DLL module was not
attached." ); |
16 } | 16 } |
17 | 17 |
18 /** | 18 /** |
19 * The attachment function is the _de facto_ equivalent of initialization. Under
ordinary circumstances, this should | 19 * The attachment function is the _de facto_ equivalent of initialization. Under
ordinary circumstances, this should |
20 * only be called once, and called before everything else. | 20 * only be called once, and called before everything else. |
21 */ | 21 */ |
22 void DLL_Module::attach( HINSTANCE handle ) | 22 void DllModule::Attach( HINSTANCE handle ) |
23 { | 23 { |
24 if ( singleton ) | 24 if ( singleton ) |
25 { | 25 { |
26 throw std::runtime_error( "May not call DLL_Module::attach() in an attached
state." ); | 26 throw std::runtime_error( "May not call DllModule::attach() in an attached s
tate." ); |
27 } | 27 } |
28 singleton = std::shared_ptr< DLL_Module >( new DLL_Module( handle ) ) ; | 28 singleton = std::shared_ptr< DllModule >( new DllModule( handle ) ) ; |
29 } | 29 } |
30 | 30 |
31 /** | 31 /** |
32 * The detachment function is the _de facto_ equivalent of finalization. Under or
dinary circumstances, this should | 32 * The detachment function is the _de facto_ equivalent of finalization. Under or
dinary circumstances, this should |
33 * only be called once, and called after everything else. | 33 * only be called once, and called after everything else. |
34 */ | 34 */ |
35 void DLL_Module::detach() | 35 void DllModule::Detach() |
36 { | 36 { |
37 singleton.reset(); | 37 singleton.reset(); |
38 } | 38 } |
39 | 39 |
40 /** | 40 /** |
41 * Since this class is mostly a replacement for a global variable, it's no surpri
sing the constructor is almost trivial. | 41 * Since this class is mostly a replacement for a global variable, it's no surpri
sing the constructor is almost trivial. |
42 */ | 42 */ |
43 DLL_Module::DLL_Module( HINSTANCE handle ) | 43 DllModule::DllModule( HINSTANCE handle ) |
44 : handle( handle ) | 44 : handle( handle ) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 std::wstring DLL_Module::name() | 48 std::wstring DllModule::name() |
49 { | 49 { |
50 if ( _name ) | 50 if ( _name ) |
51 return *_name ; | 51 return *_name ; |
52 throw std::runtime_error( "Not yet implemented" ); | 52 throw std::runtime_error( "Not yet implemented" ); |
53 } | 53 } |
LEFT | RIGHT |