-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtility.h
More file actions
57 lines (48 loc) · 1.25 KB
/
Utility.h
File metadata and controls
57 lines (48 loc) · 1.25 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
/************************************************************************************
Copyright(C):
FileName:Utility.h
Description:公共接口
Author:xiaowei.han
Date:2016-9-11
Others:
Histroy:
************************************************************************************/
#ifndef UTILITY_H
#define UTILITY_H
#include <string>
#include <boost/checked_delete.hpp>
namespace Utility
{
//获取可执行文件的绝对路径
std::string GetExeDirecory(void);
//多字节向宽字节转换
std::wstring MultiByte2WideChar(const char* szSrc);
//宽字节向多字节转换
std::string WideChar2MultiByte(const wchar_t* szSrc);
#if 0
//从硬盘位图文件加载位图
HBITMAP LoadBitmapFromFile(const char* szBitmapFile);
int AfxBCGPMessageBox(const CString& strText,UINT nType = MB_OK);
BYTE CalCRC8(BYTE* pBuf,int nsize);
//UTF-8->GBK
std::string ConverUTF8ToGB2312( const std::string& strContent );
//UTF-8->ASCII
std::string ConverUTF8ToASCII(std::string& strContent);
#endif
}
//删除对象的函数模板
template <typename T>
void SafeDeleter(T* p)
{
using namespace boost;
checked_delete(p);
}
template <typename T>
void SafeArrayDeleter(T* p)
{
using namespace boost;
checked_array_delete(p);
}
//计算数组大小
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#endif