blob: 0e760f5013413fbfc9afc61fad2ba228eafe814d (
plain)
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
|
#if !defined(WHATS_NG_UTILS_H)
#define WHATS_NG_UTILS_H
#include "WhatsAPI++/IMutex.h"
class Mutex : public IMutex
{
mir_cs m_cs;
public:
Mutex() {}
virtual ~Mutex() {}
virtual void lock()
{
CRITICAL_SECTION &cs = m_cs;
::EnterCriticalSection(&cs);
}
virtual void unlock()
{
CRITICAL_SECTION &cs = m_cs;
::LeaveCriticalSection(&cs);
}
};
std::string getLastErrorMsg();
__forceinline TCHAR* str2t(const std::string &str)
{ return mir_utf8decodeT(str.c_str());
}
std::vector<std::string> split(const std::string &s, char delim);
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
namespace utils
{
TCHAR* removeA(TCHAR *str);
void copyText(HWND hwnd, const TCHAR *text);
void setStatusMessage(MCONTACT hContact, const TCHAR *ptszMessage);
BYTE* md5string(const BYTE*, int, BYTE* digest);
__forceinline BYTE* md5string(const std::string &str, BYTE* digest)
{
return md5string((BYTE*)str.data(), (int)str.length(), digest);
}
};
#endif
|