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
79
80
81
82
83
84
85
86
87
88
|
// Common/StringConvert.h
#ifndef __COMMON_STRING_CONVERT_H
#define __COMMON_STRING_CONVERT_H
#include "MyString.h"
#include "MyWindows.h"
UString MultiByteToUnicodeString(const AString &src, UINT codePage = CP_ACP);
UString MultiByteToUnicodeString(const char *src, UINT codePage = CP_ACP);
// optimized versions that work faster for ASCII strings
void MultiByteToUnicodeString2(UString &dest, const AString &src, UINT codePage = CP_ACP);
// void UnicodeStringToMultiByte2(AString &dest, const UString &s, UINT codePage, char defaultChar, bool &defaultCharWasUsed);
void UnicodeStringToMultiByte2(AString &dest, const UString &src, UINT codePage);
AString UnicodeStringToMultiByte(const UString &src, UINT codePage, char defaultChar, bool &defaultCharWasUsed);
AString UnicodeStringToMultiByte(const UString &src, UINT codePage = CP_ACP);
inline const wchar_t* GetUnicodeString(const wchar_t *u) { return u; }
inline const UString& GetUnicodeString(const UString &u) { return u; }
inline UString GetUnicodeString(const AString &a) { return MultiByteToUnicodeString(a); }
inline UString GetUnicodeString(const char *a) { return MultiByteToUnicodeString(a); }
inline UString GetUnicodeString(const AString &a, UINT codePage)
{ return MultiByteToUnicodeString(a, codePage); }
inline UString GetUnicodeString(const char *a, UINT codePage)
{ return MultiByteToUnicodeString(a, codePage); }
inline const wchar_t* GetUnicodeString(const wchar_t *u, UINT) { return u; }
inline const UString& GetUnicodeString(const UString &u, UINT) { return u; }
inline const char* GetAnsiString(const char *a) { return a; }
inline const AString& GetAnsiString(const AString &a) { return a; }
inline AString GetAnsiString(const wchar_t *u) { return UnicodeStringToMultiByte(UString(u)); }
inline AString GetAnsiString(const UString &u) { return UnicodeStringToMultiByte(u); }
/*
inline const char* GetOemString(const char* oem)
{ return oem; }
inline const AString& GetOemString(const AString &oem)
{ return oem; }
*/
const char* GetOemString(const char* oem);
const AString& GetOemString(const AString &oem);
inline AString GetOemString(const UString &u)
{ return UnicodeStringToMultiByte(u, CP_OEMCP); }
#ifdef _UNICODE
inline const wchar_t* GetSystemString(const wchar_t *u) { return u;}
inline const UString& GetSystemString(const UString &u) { return u;}
inline const wchar_t* GetSystemString(const wchar_t *u, UINT /* codePage */) { return u;}
inline const UString& GetSystemString(const UString &u, UINT /* codePage */) { return u;}
inline UString GetSystemString(const AString &a, UINT codePage) { return MultiByteToUnicodeString(a, codePage); }
inline UString GetSystemString(const char *a, UINT codePage) { return MultiByteToUnicodeString(a, codePage); }
inline UString GetSystemString(const AString &a) { return MultiByteToUnicodeString(a); }
inline UString GetSystemString(const char *a) { return MultiByteToUnicodeString(a); }
#else
inline const char* GetSystemString(const char *a) { return a; }
inline const AString& GetSystemString(const AString &a) { return a; }
inline const char* GetSystemString(const char *a, UINT) { return a; }
inline const AString& GetSystemString(const AString &a, UINT) { return a; }
inline AString GetSystemString(const wchar_t *u) { return UnicodeStringToMultiByte(UString(u)); }
inline AString GetSystemString(const UString &u) { return UnicodeStringToMultiByte(u); }
inline AString GetSystemString(const UString &u, UINT codePage) { return UnicodeStringToMultiByte(u, codePage); }
/*
inline AString GetSystemString(const wchar_t *u)
{
UString s;
s = u;
return UnicodeStringToMultiByte(s);
}
*/
#endif
#ifndef UNDER_CE
AString SystemStringToOemString(const CSysString &src);
#endif
#endif
|