-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobal.cpp
More file actions
78 lines (69 loc) · 1.45 KB
/
Global.cpp
File metadata and controls
78 lines (69 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "stdafx.h"
namespace local {
Global* __gpGlobal = nullptr;
Global* GlobalGet() { return __gpGlobal; }
HINSTANCE __gpHinstance = nullptr;
Global::Global() {
}
Global::~Global() {
UnInit();
}
bool Global::Init() {
do {
if (m_Ready.load())
break;
m_pLibuv = new libuvpp::Libuv();
m_pServer = dynamic_cast<libuvpp::Server*>(m_pLibuv->CreateServer());
m_pLibcurl = new libcurlpp::Libcurlpp();
m_pPCHacker = new PCHacker();
m_Ready.store(true);
} while (0);
return m_Ready.load();
}
void Global::UnInit() {
do {
if (!m_Ready.load())
break;
SK_DELETE_PTR(m_pLibuv);
m_pLibcurl->Release();
m_Ready.store(false);
} while (0);
SK_DELETE_PTR(m_pPCHacker);
}
PCHacker* Global::PCHackerGet() {
PCHacker* result = nullptr;
do {
if (!__gpGlobal)
break;
result = __gpGlobal->m_pPCHacker;
} while (0);
return result;
}
libcurlpp::Libcurlpp* Global::LibcurlGet() {
libcurlpp::Libcurlpp* result = nullptr;
do {
if (!__gpGlobal)
break;
result = __gpGlobal->m_pLibcurl;
} while (0);
return result;
}
libuvpp::Server* Global::ServerGet() {
libuvpp::Server* result = nullptr;
do {
if (!__gpGlobal)
break;
result = __gpGlobal->m_pServer;
} while (0);
return result;
}
libuvpp::Libuv* Global::LibuvGet() {
libuvpp::Libuv* result = nullptr;
do {
if (!__gpGlobal)
break;
result = __gpGlobal->m_pLibuv;
} while (0);
return result;
}
}///namespace local