view src/win32/7zip/7z/CPP/Common/StringConvert.h @ 3:b05d00f19d80

fix some formatting
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:33:11 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // Common/StringConvert.h
3 #ifndef __COMMON_STRINGCONVERT_H
4 #define __COMMON_STRINGCONVERT_H
6 #include "MyWindows.h"
7 #include "MyString.h"
8 #include "Types.h"
10 UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP);
11 AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage, char defaultChar, bool &defaultCharWasUsed);
12 AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage = CP_ACP);
15 inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString)
16 { return unicodeString; }
17 inline const UString& GetUnicodeString(const UString &unicodeString)
18 { return unicodeString; }
19 inline UString GetUnicodeString(const AString &ansiString)
20 { return MultiByteToUnicodeString(ansiString); }
21 inline UString GetUnicodeString(const AString &multiByteString, UINT codePage)
22 { return MultiByteToUnicodeString(multiByteString, codePage); }
23 inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString, UINT)
24 { return unicodeString; }
25 inline const UString& GetUnicodeString(const UString &unicodeString, UINT)
26 { return unicodeString; }
28 inline const char* GetAnsiString(const char* ansiString)
29 { return ansiString; }
30 inline const AString& GetAnsiString(const AString &ansiString)
31 { return ansiString; }
32 inline AString GetAnsiString(const UString &unicodeString)
33 { return UnicodeStringToMultiByte(unicodeString); }
35 inline const char* GetOemString(const char* oemString)
36 { return oemString; }
37 inline const AString& GetOemString(const AString &oemString)
38 { return oemString; }
39 inline AString GetOemString(const UString &unicodeString)
40 { return UnicodeStringToMultiByte(unicodeString, CP_OEMCP); }
43 #ifdef _UNICODE
44 inline const wchar_t* GetSystemString(const wchar_t* unicodeString)
45 { return unicodeString;}
46 inline const UString& GetSystemString(const UString &unicodeString)
47 { return unicodeString;}
48 inline const wchar_t* GetSystemString(const wchar_t* unicodeString, UINT /* codePage */)
49 { return unicodeString;}
50 inline const UString& GetSystemString(const UString &unicodeString, UINT /* codePage */)
51 { return unicodeString;}
52 inline UString GetSystemString(const AString &multiByteString, UINT codePage)
53 { return MultiByteToUnicodeString(multiByteString, codePage);}
54 inline UString GetSystemString(const AString &multiByteString)
55 { return MultiByteToUnicodeString(multiByteString);}
56 #else
57 inline const char* GetSystemString(const char *ansiString)
58 { return ansiString; }
59 inline const AString& GetSystemString(const AString &multiByteString, UINT)
60 { return multiByteString; }
61 inline const char * GetSystemString(const char *multiByteString, UINT)
62 { return multiByteString; }
63 inline AString GetSystemString(const UString &unicodeString)
64 { return UnicodeStringToMultiByte(unicodeString); }
65 inline AString GetSystemString(const UString &unicodeString, UINT codePage)
66 { return UnicodeStringToMultiByte(unicodeString, codePage); }
67 #endif
69 #ifndef _WIN32_WCE
70 AString SystemStringToOemString(const CSysString &srcString);
71 #endif
73 #endif