Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: installer/src/installer-lib/DLL.cpp

Issue 6202981292703744: Whole installer (Closed)
Patch Set: Created June 24, 2014, 7:27 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * \file abp_ca.cpp Top-level source for custom actions. Includes DLL initializa tion. 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< DLL_Module > DLL_Module::singleton = 0 ;
8 8
9 DLL_Module & 9 DLL_Module & DLL_Module::module()
10 DLL_Module::module()
11 { 10 {
12 if ( singleton ) 11 if ( singleton )
13 { 12 {
14 return * singleton; 13 return * singleton;
15 } 14 }
16 throw std::runtime_error( "DLL_Module::module() called when DLL module was not attached." ); 15 throw std::runtime_error( "DLL_Module::module() called when DLL module was not attached." );
17 } 16 }
18 17
19 /** 18 /**
20 * 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
21 * only be called once, and called before everything else. 20 * only be called once, and called before everything else.
22 */ 21 */
23 void 22 void DLL_Module::attach( HINSTANCE handle )
24 DLL_Module::attach( HINSTANCE handle )
25 { 23 {
26 if ( singleton ) 24 if ( singleton )
27 { 25 {
28 throw std::runtime_error( "May not call DLL_Module::attach() in an attached state." ); 26 throw std::runtime_error( "May not call DLL_Module::attach() in an attached state." );
29 } 27 }
30 singleton = std::shared_ptr< DLL_Module >( new DLL_Module( handle ) ) ; 28 singleton = std::shared_ptr< DLL_Module >( new DLL_Module( handle ) ) ;
31 } 29 }
32 30
33 /** 31 /**
34 * The detachment function is the _de facto_ equivalent of finalization. Under o rdinary circumstances, this should 32 * The detachment function is the _de facto_ equivalent of finalization. Under or dinary circumstances, this should
35 * only be called once, and called after everything else. 33 * only be called once, and called after everything else.
36 */ 34 */
37 void 35 void DLL_Module::detach()
38 DLL_Module::detach()
39 { 36 {
40 singleton.reset(); 37 singleton.reset();
41 } 38 }
42 39
43 /** 40 /**
44 * Since this class is mostly a replacement for a global variable, it's no surpr ising 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.
45 */ 42 */
46 DLL_Module::DLL_Module( HINSTANCE handle ) 43 DLL_Module::DLL_Module( HINSTANCE handle )
47 : handle( handle ) 44 : handle( handle )
48 { 45 {
49 } 46 }
50 47
51 std::wstring 48 std::wstring DLL_Module::name()
52 DLL_Module::name()
53 { 49 {
54 if ( _name ) 50 if ( _name )
55 return *_name ; 51 return *_name ;
56 throw std::runtime_error( "Not yet implemented" ); 52 throw std::runtime_error( "Not yet implemented" );
57 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld