summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/hdr/modern_tstring.h
blob: 36d7e30ad32d81f09ffc93b5d6fc10fc7fbb8ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef UNICODE	//FIXME Build without UNICODE flag
#define _AtlGetConversionACP() CP_THREAD_ACP
#endif

#include "MString.h"

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()); }
};