From 725f68b6808a8a30778f58223fac75386f082785 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 18 May 2012 22:10:43 +0000 Subject: plugins folders renaming git-svn-id: http://svn.miranda-ng.org/main/trunk@61 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Modernb/hdr/modern_tstring.h | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins/Modernb/hdr/modern_tstring.h (limited to 'plugins/Modernb/hdr/modern_tstring.h') diff --git a/plugins/Modernb/hdr/modern_tstring.h b/plugins/Modernb/hdr/modern_tstring.h new file mode 100644 index 0000000000..5bd558c54d --- /dev/null +++ b/plugins/Modernb/hdr/modern_tstring.h @@ -0,0 +1,58 @@ +#ifndef UNICODE //FIXME Build without UNICODE flag +#define _AtlGetConversionACP() CP_THREAD_ACP +#endif + +#include "MString.h" + +#ifdef UNICODE +typedef CMStringA astring; +typedef CMStringW wstring; + +class mbstring : public astring +{ + // It is prohibited to initialize by char* outside, use L"xxx" +private: + mbstring( const char * pChar ) : astring( pChar ) {}; + mbstring& operator=( const char * pChar ) { this->operator =( pChar ); return *this; } + +public: + mbstring() : astring() {}; + mbstring( const mbstring& uStr ) : astring( uStr ) {}; + + + mbstring( const wstring& tStr ) { *this = tStr.c_str(); } + mbstring& operator=( const wstring& tStr ) { this->operator =( tStr.c_str() ); return *this; } + + mbstring( const wchar_t * wChar ); + mbstring& operator=( const astring& aStr ); + mbstring& operator=( const wchar_t * wChar ); + operator wstring(); + operator astring(); +}; + + +class tstring : public wstring +{ +public: + tstring() : wstring() {}; + tstring(const wchar_t * pwChar) : wstring( pwChar ) {}; + + + tstring(const astring& aStr) { *this = aStr.c_str(); } + tstring(const mbstring& utfStr) { *this = utfStr; } + + tstring(const char * pChar); + tstring& operator=( const char * pChar ); + tstring& operator=( const astring& aStr ); + tstring& operator=( const mbstring& uStr ); + operator astring(); + operator mbstring() { return mbstring( this->c_str() ); } +}; + +#else +typedef CMStringA astring; +typedef CMStringA wstring; +typedef CMStringA tstring; +typedef CMStringA mbstring; + +#endif -- cgit v1.2.3