Mercurial > vba-clojure
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/7z/CPP/Common/StringConvert.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,73 @@ 1.4 +// Common/StringConvert.h 1.5 + 1.6 +#ifndef __COMMON_STRINGCONVERT_H 1.7 +#define __COMMON_STRINGCONVERT_H 1.8 + 1.9 +#include "MyWindows.h" 1.10 +#include "MyString.h" 1.11 +#include "Types.h" 1.12 + 1.13 +UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP); 1.14 +AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage, char defaultChar, bool &defaultCharWasUsed); 1.15 +AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage = CP_ACP); 1.16 + 1.17 + 1.18 +inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString) 1.19 + { return unicodeString; } 1.20 +inline const UString& GetUnicodeString(const UString &unicodeString) 1.21 + { return unicodeString; } 1.22 +inline UString GetUnicodeString(const AString &ansiString) 1.23 + { return MultiByteToUnicodeString(ansiString); } 1.24 +inline UString GetUnicodeString(const AString &multiByteString, UINT codePage) 1.25 + { return MultiByteToUnicodeString(multiByteString, codePage); } 1.26 +inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString, UINT) 1.27 + { return unicodeString; } 1.28 +inline const UString& GetUnicodeString(const UString &unicodeString, UINT) 1.29 + { return unicodeString; } 1.30 + 1.31 +inline const char* GetAnsiString(const char* ansiString) 1.32 + { return ansiString; } 1.33 +inline const AString& GetAnsiString(const AString &ansiString) 1.34 + { return ansiString; } 1.35 +inline AString GetAnsiString(const UString &unicodeString) 1.36 + { return UnicodeStringToMultiByte(unicodeString); } 1.37 + 1.38 +inline const char* GetOemString(const char* oemString) 1.39 + { return oemString; } 1.40 +inline const AString& GetOemString(const AString &oemString) 1.41 + { return oemString; } 1.42 +inline AString GetOemString(const UString &unicodeString) 1.43 + { return UnicodeStringToMultiByte(unicodeString, CP_OEMCP); } 1.44 + 1.45 + 1.46 +#ifdef _UNICODE 1.47 + inline const wchar_t* GetSystemString(const wchar_t* unicodeString) 1.48 + { return unicodeString;} 1.49 + inline const UString& GetSystemString(const UString &unicodeString) 1.50 + { return unicodeString;} 1.51 + inline const wchar_t* GetSystemString(const wchar_t* unicodeString, UINT /* codePage */) 1.52 + { return unicodeString;} 1.53 + inline const UString& GetSystemString(const UString &unicodeString, UINT /* codePage */) 1.54 + { return unicodeString;} 1.55 + inline UString GetSystemString(const AString &multiByteString, UINT codePage) 1.56 + { return MultiByteToUnicodeString(multiByteString, codePage);} 1.57 + inline UString GetSystemString(const AString &multiByteString) 1.58 + { return MultiByteToUnicodeString(multiByteString);} 1.59 +#else 1.60 + inline const char* GetSystemString(const char *ansiString) 1.61 + { return ansiString; } 1.62 + inline const AString& GetSystemString(const AString &multiByteString, UINT) 1.63 + { return multiByteString; } 1.64 + inline const char * GetSystemString(const char *multiByteString, UINT) 1.65 + { return multiByteString; } 1.66 + inline AString GetSystemString(const UString &unicodeString) 1.67 + { return UnicodeStringToMultiByte(unicodeString); } 1.68 + inline AString GetSystemString(const UString &unicodeString, UINT codePage) 1.69 + { return UnicodeStringToMultiByte(unicodeString, codePage); } 1.70 +#endif 1.71 + 1.72 +#ifndef _WIN32_WCE 1.73 +AString SystemStringToOemString(const CSysString &srcString); 1.74 +#endif 1.75 + 1.76 +#endif