1
0
forked from 0ad/0ad

Altered the automatic CStr8/CStrW conversion -- it seems to work now

This was SVN commit r1131.
This commit is contained in:
Ykkrosh 2004-09-06 11:15:43 +00:00
parent d373e7a559
commit f791e5f665
2 changed files with 13 additions and 11 deletions

View File

@ -9,6 +9,10 @@
#define UNIDOUBLER_HEADER "CStr.cpp"
#include "UniDoubler.h"
// Only include these function definitions in the first instance of CStr.cpp:
CStrW::CStrW(const CStr8 &asciStr) : m_String(asciStr.m_String.begin(), asciStr.m_String.end()) {}
CStr8::CStr8(const CStrW &wideStr) : m_String(wideStr.m_String.begin(), wideStr.m_String.end()) {}
#else
#include "CStr.h"

View File

@ -90,11 +90,16 @@ enum PS_TRIM_MODE {PS_TRIM_LEFT, PS_TRIM_RIGHT, PS_TRIM_BOTH};
#endif
class CStr8;
class CStrW;
// CStr class, the mother of all strings
class CStr: public ISerializable
{
#ifdef _UNICODE
friend class CStr8;
#else
friend class CStrW;
#endif
public:
@ -102,18 +107,11 @@ public:
CStr(); // Default constructor
CStr(const CStr& Str); // Copy Constructor
// Transparent CStrW/8 conversion. Note that CStr8 will provide both
// definitions since CStrW is defined first - would otherwise result in a
// circular dependency
// Transparent CStrW/8 conversion.
#ifndef _UNICODE
inline CStr8(const CStrW &wideStr):
m_String(wideStr.m_String.begin(), wideStr.m_String.end())
{}
inline operator CStrW ()
{
return CStrW(std::wstring(m_String.begin(), m_String.end()));
}
CStr8(const CStrW &wideStr);
#else
CStrW(const CStr8 &asciiStr);
#endif
CStr(std::tstring String); // Creates CStr from C++ string