2020-03-10 17:50:55 +01:00
|
|
|
//*************************************************************************************************
|
|
|
|
//*************************************************************************************************
|
|
|
|
//
|
|
|
|
// STRING
|
|
|
|
//
|
|
|
|
// Developed by jief666, from 1997.
|
|
|
|
//
|
|
|
|
//*************************************************************************************************
|
|
|
|
//*************************************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(__XStringW_CPP__)
|
|
|
|
#define __XStringW_CPP__
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#define DBG(...) DebugLog(2, __VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define DBG(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "XToolsCommon.h"
|
|
|
|
#include "XStringWP.h"
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
#include "../../Include/Library/printf_lite.h"
|
2020-03-10 17:50:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
// Constructor
|
|
|
|
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
|
|
|
|
|
|
|
|
XStringWP::XStringWP(const wchar_t *S)
|
|
|
|
{
|
|
|
|
if ( !S ) {
|
|
|
|
DebugLog(2, "XStringWP(const wchar_t *S) called with NULL. Use setEmpty()\n");
|
|
|
|
panic();
|
|
|
|
}
|
2020-03-25 19:32:44 +01:00
|
|
|
DBG("Constructor(const wchar_t *S) : %ls, StrLen(S)=%d\n", S, StrLen(S));
|
2020-03-21 14:12:26 +01:00
|
|
|
Init(wcslen(S));
|
2020-03-10 17:50:55 +01:00
|
|
|
StrCpy(S);
|
|
|
|
}
|
|
|
|
|
|
|
|
XStringWP::XStringWP(const char* S)
|
|
|
|
{
|
|
|
|
DBG("Constructor(const char* S)\n");
|
2020-03-11 15:23:58 +01:00
|
|
|
xsize newLen = StrLenInWChar(S);
|
2020-03-10 17:50:55 +01:00
|
|
|
Init(newLen);
|
2020-03-11 15:23:58 +01:00
|
|
|
utf8ToWChar(m_data, m_allocatedSize+1, S); // m_size doesn't count the NULL terminator
|
2020-03-10 17:50:55 +01:00
|
|
|
SetLength(newLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|