diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-10-29 18:17:04 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-10-29 18:17:04 +0000 |
commit | 4d01f5f5096cb4d22c4a7ba17cc82977c7f5f19b (patch) | |
tree | 9353d79ddff12a1c2ced3e300d61a516f2572fb5 /plugins/MirandaG15/LCDFramework/src/misc.h | |
parent | 2307fd7414d16d4ff936607a215e9a2ca0294741 (diff) |
Adopted MirandaG15 plugin
First compilable version and 32-bit only.
git-svn-id: http://svn.miranda-ng.org/main/trunk@6681 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirandaG15/LCDFramework/src/misc.h')
-rw-r--r-- | plugins/MirandaG15/LCDFramework/src/misc.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/plugins/MirandaG15/LCDFramework/src/misc.h b/plugins/MirandaG15/LCDFramework/src/misc.h new file mode 100644 index 0000000000..43e35327c5 --- /dev/null +++ b/plugins/MirandaG15/LCDFramework/src/misc.h @@ -0,0 +1,97 @@ +extern BOOL IsUnicodeAscii(const wchar_t* pBuffer, int nSize);
+extern tstring toLower(const tstring &i_str);
+
+extern std::wstring toWideString( const char* pStr , int len=-1 ) ;
+inline std::wstring toWideString( const std::string& str )
+{
+ return toWideString(str.c_str(),str.length()) ;
+}
+inline std::wstring toWideString( const wchar_t* pStr , int len=-1 )
+{
+ return (len < 0) ? pStr : std::wstring(pStr,len) ;
+}
+inline std::wstring toWideString( const std::wstring& str )
+{
+ return str ;
+}
+extern std::string toNarrowString( const wchar_t* pStr , int len=-1 ) ;
+inline std::string toNarrowString( const std::wstring& str )
+{
+ return toNarrowString(str.c_str(),str.length()) ;
+}
+inline std::string toNarrowString( const char* pStr , int len=-1 )
+{
+ return (len < 0) ? pStr : std::string(pStr,len) ;
+}
+inline std::string toNarrowString( const std::string& str )
+{
+ return str ;
+}
+
+#ifdef _UNICODE
+ #define tstring wstring
+ inline TCHAR toTchar( char ch )
+ {
+ return (wchar_t)ch ;
+ }
+ inline TCHAR toTchar( wchar_t ch )
+ {
+ return ch ;
+ }
+ inline std::tstring toTstring( const std::string& s )
+ {
+ return toWideString(s) ;
+ }
+ inline std::tstring toTstring( const char* p , int len=-1 )
+ {
+ return toWideString(p,len) ;
+ }
+ inline std::tstring toTstring( const std::wstring& s )
+ {
+ return s ;
+ }
+ inline std::tstring toTstring( const wchar_t* p , int len=-1 )
+ {
+ return p == NULL?L"":((len < 0) ? p : std::wstring(p,len));
+ }
+
+ extern tstring Utf8_Decode(const char *str);
+
+// extern WCHAR *Utf8_Decode(const char *str);
+ extern string Utf8_Encode(const WCHAR *str);
+#else
+ #define tstring string
+ inline TCHAR toTchar( char ch )
+ {
+ return ch ;
+ }
+ inline TCHAR toTchar( wchar_t ch )
+ {
+ return (ch >= 0 && ch <= 0xFF) ? (char)ch : '?' ;
+ }
+ inline std::tstring toTstring( const std::string& s )
+ {
+ return s ;
+ }
+ inline std::tstring toTstring( const char* p , int len=-1 )
+ {
+ if(p == NULL)
+ return "";
+ return (len < 0) ? p : std::string(p,len) ;
+ }
+ inline std::tstring toTstring( const std::wstring& s )
+ {
+ return toNarrowString(s) ;
+ }
+ inline std::tstring toTstring( const wchar_t* p , int len=-1 )
+ {
+ return toNarrowString(p,len) ;
+ }
+#endif // _UNICODE
+
+ // Zufallszahlen
+
+extern int GetRandomInt(int iMin, int iMax);
+extern double GetRandomDouble();
+
+extern tstring tstringprintf(tstring strFormat,...);
\ No newline at end of file |