annotate src/win32/7zip/7z/CPP/Common/StringConvert.h @ 1:f9f4f1b99eed

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