Common: Update std string class
This commit is contained in:
parent
727f730f79
commit
9e9fdc25bc
|
@ -39,7 +39,7 @@ public:
|
||||||
OutputDebugString(Message);
|
OutputDebugString(Message);
|
||||||
if (EndOfLine)
|
if (EndOfLine)
|
||||||
{
|
{
|
||||||
OutputDebugString(_T("\n"));
|
OutputDebugString("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,7 +101,7 @@ stdstr FileVersionInfo( LPCTSTR Info, LPCTSTR FileName )
|
||||||
{
|
{
|
||||||
if (strcmp(Info,VERSION_PRODUCT_VERSION) == 0)
|
if (strcmp(Info,VERSION_PRODUCT_VERSION) == 0)
|
||||||
{
|
{
|
||||||
Result.replace(" ","");
|
Result.Replace(" ","");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WriteTraceF(TraceError,_T("FileVersionInfo(%s), ReadVersionInfo() failed"), FileName);
|
WriteTraceF(TraceError,_T("FileVersionInfo(%s), ReadVersionInfo() failed"), FileName);
|
||||||
|
|
|
@ -2496,16 +2496,26 @@ BOOL CPath::CreateDirectory(BOOL bCreateIntermediates /*= TRUE*/)
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
void CPath::cleanPathString(stdstr& rDirectory) const
|
void CPath::cleanPathString(stdstr& rDirectory) const
|
||||||
{
|
{
|
||||||
rDirectory.replace(DIRECTORY_DELIMITER2,DIRECTORY_DELIMITER);
|
LPCSTR const DIR_DOUBLEDELIM = "\\\\";
|
||||||
|
|
||||||
if(!_tcsnicmp(rDirectory.c_str(), _T("\\\\"), 2))
|
std::string::size_type pos = rDirectory.find( DIRECTORY_DELIMITER2 );
|
||||||
|
while ( pos != std::string::npos )
|
||||||
{
|
{
|
||||||
rDirectory.replace(DIR_DOUBLEDELIM,DIRECTORY_DELIMITER);
|
rDirectory.replace( pos, 1, &DIRECTORY_DELIMITER );
|
||||||
|
pos = rDirectory.find( DIRECTORY_DELIMITER2, pos + 1 );
|
||||||
rDirectory.insert(0, _T("\\"));
|
}
|
||||||
|
|
||||||
|
bool AppendEnd = !_strnicmp(rDirectory.c_str(), "\\\\", 2);
|
||||||
|
pos = rDirectory.find( DIR_DOUBLEDELIM );
|
||||||
|
while ( pos != std::string::npos )
|
||||||
|
{
|
||||||
|
rDirectory.replace( pos, 1, &DIRECTORY_DELIMITER );
|
||||||
|
pos = rDirectory.find( DIR_DOUBLEDELIM, pos + 1 );
|
||||||
|
}
|
||||||
|
if (AppendEnd)
|
||||||
|
{
|
||||||
|
rDirectory.insert(0, "\\");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
rDirectory.replace(DIR_DOUBLEDELIM,DIRECTORY_DELIMITER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPath::StripLeadingChar(stdstr& rText, TCHAR chLeading) const
|
void CPath::StripLeadingChar(stdstr& rText, TCHAR chLeading) const
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "std string.h"
|
#include "std string.h"
|
||||||
#include <sys\types.h>
|
#include <sys\types.h>
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
|
#include <WTypes.h>
|
||||||
|
|
||||||
class CPathException
|
class CPathException
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,43 +1,72 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <algorithm>
|
||||||
void stdstr::ArgFormat(const TCHAR * strFormat, va_list & args)
|
|
||||||
{
|
|
||||||
if (strFormat != NULL) {
|
|
||||||
// declare buffer (default max buffer size = 32k)
|
|
||||||
const int nMaxSize = 32*1024;
|
|
||||||
TCHAR pBuffer[nMaxSize];
|
|
||||||
|
|
||||||
_vsntprintf(pBuffer,nMaxSize - 1,strFormat,args);
|
|
||||||
pBuffer[nMaxSize - 1] = 0;
|
|
||||||
|
|
||||||
tstring * _this = this;
|
|
||||||
*_this = pBuffer;
|
|
||||||
} else {
|
|
||||||
*((tstring *)this) = _T("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stdstr::stdstr()
|
stdstr::stdstr()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stdstr::stdstr( const tstring & str )
|
stdstr::stdstr( const std::string & str ) :
|
||||||
{
|
std::string(str)
|
||||||
*((tstring *)this) = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
stdstr::stdstr( const stdstr & str )
|
|
||||||
{
|
{
|
||||||
*((tstring *)this) = (tstring)str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stdstr::stdstr( const TCHAR * str )
|
stdstr::stdstr( const stdstr & str ) :
|
||||||
|
std::string((const std::string &)str)
|
||||||
{
|
{
|
||||||
*((tstring *)this) = str ? str : "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stdstr::Format(const TCHAR * strFormat, ...)
|
stdstr::stdstr( const char * str ) :
|
||||||
|
std::string(str ? str : "")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
strvector stdstr::Tokenize(const char * delimiter) const
|
||||||
|
{
|
||||||
|
strvector tokens;
|
||||||
|
|
||||||
|
stdstr::size_type lastPos = find_first_not_of(delimiter, 0);
|
||||||
|
stdstr::size_type pos = find_first_of(delimiter, lastPos);
|
||||||
|
while (stdstr::npos != pos || stdstr::npos != lastPos)
|
||||||
|
{
|
||||||
|
tokens.push_back(substr(lastPos, pos - lastPos));
|
||||||
|
lastPos = find_first_not_of(delimiter, pos);
|
||||||
|
pos = find_first_of(delimiter, lastPos);
|
||||||
|
}
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
strvector stdstr::Tokenize(char delimiter) const
|
||||||
|
{
|
||||||
|
strvector tokens;
|
||||||
|
|
||||||
|
stdstr::size_type lastPos = find_first_not_of(delimiter, 0);
|
||||||
|
stdstr::size_type pos = find_first_of(delimiter, lastPos);
|
||||||
|
while (stdstr::npos != pos || stdstr::npos != lastPos)
|
||||||
|
{
|
||||||
|
tokens.push_back(substr(lastPos, pos - lastPos));
|
||||||
|
lastPos = find_first_not_of(delimiter, pos);
|
||||||
|
pos = find_first_of(delimiter, lastPos);
|
||||||
|
}
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stdstr::ArgFormat(const char * strFormat, va_list & args)
|
||||||
|
{
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4996)
|
||||||
|
|
||||||
|
size_t nlen = _vscprintf( strFormat, args ) + 1;
|
||||||
|
char * buffer = (char *)alloca(nlen * sizeof(char));
|
||||||
|
buffer[nlen - 1] = 0;
|
||||||
|
if(buffer != NULL)
|
||||||
|
{
|
||||||
|
vsprintf( buffer, strFormat , args );
|
||||||
|
*this = buffer;
|
||||||
|
}
|
||||||
|
#pragma warning(pop)
|
||||||
|
}
|
||||||
|
|
||||||
|
void stdstr::Format(const char * strFormat, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, strFormat);
|
va_start(args, strFormat);
|
||||||
|
@ -45,210 +74,165 @@ void stdstr::Format(const TCHAR * strFormat, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stdstr::replace(const TCHAR search, const TCHAR replace )
|
stdstr& stdstr::ToLower(void)
|
||||||
{
|
{
|
||||||
tstring& str = *this;
|
std::transform(begin(), end(), begin(), (int(*)(int)) tolower);
|
||||||
tstring::size_type pos = str.find( search );
|
return *this;
|
||||||
while ( pos != tstring::npos )
|
}
|
||||||
|
|
||||||
|
stdstr& stdstr::ToUpper(void)
|
||||||
|
{
|
||||||
|
std::transform(begin(), end(), begin(), (int(*)(int)) toupper);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stdstr::Replace(const char search, const char replace )
|
||||||
|
{
|
||||||
|
std::string& str = *this;
|
||||||
|
std::string::size_type pos = str.find( search );
|
||||||
|
while ( pos != std::string::npos )
|
||||||
{
|
{
|
||||||
str.replace( pos, 1, &replace );
|
str.replace( pos, 1, &replace );
|
||||||
pos = str.find( search, pos + 1 );
|
pos = str.find( search, pos + 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stdstr::replace(const TCHAR * search, const TCHAR replace )
|
void stdstr::Replace(const char * search, const char replace )
|
||||||
{
|
{
|
||||||
tstring& str = *this;
|
std::string& str = *this;
|
||||||
tstring::size_type pos = str.find( search );
|
std::string::size_type pos = str.find( search );
|
||||||
size_t SearchSize = _tcslen(search);
|
size_t SearchSize = strlen(search);
|
||||||
while ( pos != tstring::npos )
|
while ( pos != std::string::npos )
|
||||||
{
|
{
|
||||||
str.replace( pos, SearchSize, &replace );
|
str.replace( pos, SearchSize, &replace );
|
||||||
pos = str.find( search, pos + 1 );
|
pos = str.find( search, pos + 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stdstr::replace(const tstring& search, const tstring& replace )
|
void stdstr::Replace(const std::string& search, const std::string& replace )
|
||||||
{
|
{
|
||||||
tstring& str = *this;
|
std::string& str = *this;
|
||||||
tstring::size_type pos = str.find( search );
|
std::string::size_type pos = str.find( search );
|
||||||
size_t SearchSize = search.size();
|
size_t SearchSize = search.size();
|
||||||
while ( pos != tstring::npos )
|
while ( pos != std::string::npos )
|
||||||
{
|
{
|
||||||
str.replace( pos, SearchSize, replace );
|
str.replace( pos, SearchSize, replace );
|
||||||
pos = str.find( search, pos + replace.length() );
|
pos = str.find( search, pos + replace.length() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stdstr& stdstr::Trim(bool StripEnter)
|
stdstr & stdstr::TrimLeft (const char * chars2remove)
|
||||||
{
|
|
||||||
tstring& str = *this;
|
|
||||||
while ((str.size() && str[0] == ' ') ||
|
|
||||||
(StripEnter && (str[0] == '\r' || str[0] == '\n')))
|
|
||||||
{
|
|
||||||
str = str.substr(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (str.size() && (str[str.size()-1] == ' ' ||
|
|
||||||
(StripEnter && (str[str.size()-1] == '\r' || str[str.size()-1] == '\n'))))
|
|
||||||
{
|
|
||||||
str = str.substr(0, str.size() - 1);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
stdstr& stdstr::ToLower(void)
|
|
||||||
{
|
|
||||||
tstring& str = *this;
|
|
||||||
std::transform(str.begin(), str.end(), str.begin(), (int(*)(int)) tolower);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
stdstr& stdstr::ToUpper(void)
|
|
||||||
{
|
|
||||||
tstring& str = *this;
|
|
||||||
std::transform(str.begin(), str.end(), str.begin(), (int(*)(int)) toupper);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
strvector stdstr::Tokenize(const stdstr& delimiters) const
|
|
||||||
{
|
|
||||||
const stdstr& str = *this;
|
|
||||||
|
|
||||||
strvector tokens;
|
|
||||||
|
|
||||||
// skip delimiters at beginning.
|
|
||||||
stdstr::size_type lastPos = str.find_first_not_of(delimiters, 0);
|
|
||||||
|
|
||||||
// find first "non-delimiter".
|
|
||||||
stdstr::size_type pos = str.find_first_of(delimiters, lastPos);
|
|
||||||
|
|
||||||
while (stdstr::npos != pos || stdstr::npos != lastPos)
|
|
||||||
{
|
|
||||||
// found a token, add it to the vector.
|
|
||||||
tokens.push_back(str.substr(lastPos, pos - lastPos));
|
|
||||||
|
|
||||||
// skip delimiters. Note the "not_of"
|
|
||||||
lastPos = str.find_first_not_of(delimiters, pos);
|
|
||||||
|
|
||||||
// find next "non-delimiter"
|
|
||||||
pos = str.find_first_of(delimiters, lastPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
void stdstr::TrimLeft (const TCHAR * chars2remove)
|
|
||||||
{
|
{
|
||||||
if (!empty())
|
if (!empty())
|
||||||
{
|
{
|
||||||
tstring::size_type pos = find_first_not_of(chars2remove);
|
std::string::size_type pos = find_first_not_of(chars2remove);
|
||||||
if (pos != tstring::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
erase(0,pos);
|
erase(0,pos);
|
||||||
} else {
|
} else {
|
||||||
erase(begin(), end()); // make empty
|
erase(begin(), end()); // make empty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stdstr::TrimRight (const TCHAR * chars2remove)
|
stdstr & stdstr::TrimRight (const char * chars2remove)
|
||||||
{
|
{
|
||||||
if (!empty())
|
if (!empty())
|
||||||
{
|
{
|
||||||
tstring::size_type pos = find_last_not_of(chars2remove);
|
std::string::size_type pos = find_last_not_of(chars2remove);
|
||||||
if (pos != tstring::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
erase(pos+1);
|
erase(pos+1);
|
||||||
} else {
|
} else {
|
||||||
erase(begin(), end()); // make empty
|
erase(begin(), end()); // make empty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
stdstr stdstr::toTString(const char *pstrSource)
|
stdstr & stdstr::Trim (const char * chars2remove)
|
||||||
{
|
{
|
||||||
#ifndef _UNICODE
|
if (!empty())
|
||||||
return pstrSource;
|
|
||||||
#else
|
|
||||||
stdstr strRet;
|
|
||||||
// Allocate enough space for the UNICODE string
|
|
||||||
int nNeeded = MultiByteToWideChar(CP_UTF8,
|
|
||||||
0,
|
|
||||||
pstrSource,
|
|
||||||
-1, //str is null terminated
|
|
||||||
NULL,
|
|
||||||
0);
|
|
||||||
if (nNeeded == 0)
|
|
||||||
{
|
{
|
||||||
return strRet;
|
std::string::size_type pos = find_first_not_of(chars2remove);
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
erase(0,pos);
|
||||||
|
} else {
|
||||||
|
erase(begin(), end()); // make empty
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = find_last_not_of(chars2remove);
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
erase(pos+1);
|
||||||
|
} else {
|
||||||
|
erase(begin(), end()); // make empty
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
wchar_t* lpStrW = new wchar_t[nNeeded + 1];
|
|
||||||
ZeroMemory(lpStrW, (nNeeded + 1)*sizeof(wchar_t));
|
|
||||||
|
|
||||||
// Convert the string from ansi to Unicode
|
|
||||||
nNeeded= MultiByteToWideChar(CP_UTF8,
|
|
||||||
0,
|
|
||||||
pstrSource,
|
|
||||||
-1, //str is null terminated
|
|
||||||
lpStrW,
|
|
||||||
nNeeded+1);
|
|
||||||
if (!nNeeded)
|
|
||||||
{
|
|
||||||
delete [] lpStrW;
|
|
||||||
return strRet;
|
|
||||||
}
|
|
||||||
strRet = lpStrW;
|
|
||||||
delete [] lpStrW;
|
|
||||||
|
|
||||||
return strRet;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string stdstr::fromTString(const stdstr &strSource)
|
stdstr & stdstr::FromUTF16 ( const wchar_t * UTF16Source, bool * bSuccess )
|
||||||
{
|
{
|
||||||
#ifndef _UNICODE
|
bool bConverted = false;
|
||||||
return strSource;
|
|
||||||
#else
|
|
||||||
std::string strRet;
|
|
||||||
// Get the size of the Unicode string
|
|
||||||
|
|
||||||
// Allocate enough space for the Ansi string
|
if (UTF16Source == NULL)
|
||||||
int nNeeded = WideCharToMultiByte(CP_UTF8,
|
|
||||||
0,
|
|
||||||
strSource.c_str(),
|
|
||||||
-1, //str is null terminated
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
if (nNeeded == 0)
|
|
||||||
{
|
{
|
||||||
return strRet;
|
*this = "";
|
||||||
}
|
bConverted = true;
|
||||||
|
}
|
||||||
char* lpStrA = new char[nNeeded + 1];
|
else if(wcslen(UTF16Source) > 0)
|
||||||
ZeroMemory(lpStrA, nNeeded + 1);
|
|
||||||
|
|
||||||
// Convert the string from Unicode to ansi
|
|
||||||
nNeeded= WideCharToMultiByte(CP_UTF8,
|
|
||||||
0,
|
|
||||||
strSource.c_str(),
|
|
||||||
-1, //str is null terminated
|
|
||||||
lpStrA,
|
|
||||||
nNeeded+1,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
if (!nNeeded)
|
|
||||||
{
|
{
|
||||||
delete [] lpStrA;
|
DWORD nNeeded = WideCharToMultiByte(CP_UTF8, 0, UTF16Source, -1, NULL, 0, NULL, NULL);
|
||||||
return strRet;
|
if(nNeeded > 0)
|
||||||
|
{
|
||||||
|
char * buf = (char *)alloca(nNeeded + 1);
|
||||||
|
if( buf != NULL )
|
||||||
|
{
|
||||||
|
memset(buf, 0, nNeeded + 1);
|
||||||
|
|
||||||
|
nNeeded = WideCharToMultiByte(CP_UTF8, 0, UTF16Source, -1, buf, nNeeded, NULL, NULL);
|
||||||
|
if (nNeeded)
|
||||||
|
{
|
||||||
|
*this = buf;
|
||||||
|
bConverted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (bSuccess)
|
||||||
strRet = lpStrA;
|
{
|
||||||
delete [] lpStrA;
|
*bSuccess = bConverted;
|
||||||
|
}
|
||||||
return strRet;
|
return *this;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
std::wstring stdstr::ToUTF16 ( bool * bSuccess)
|
||||||
|
{
|
||||||
|
bool bConverted = false;
|
||||||
|
std::wstring res;
|
||||||
|
|
||||||
|
DWORD nNeeded = MultiByteToWideChar(CP_UTF8, 0, this->c_str(), (int)this->length(), NULL, 0);
|
||||||
|
if(nNeeded > 0)
|
||||||
|
{
|
||||||
|
wchar_t * buf = (wchar_t *)alloca((nNeeded + 1) * sizeof(wchar_t));
|
||||||
|
if( buf != NULL )
|
||||||
|
{
|
||||||
|
memset(buf, 0, (nNeeded + 1) * sizeof(wchar_t));
|
||||||
|
|
||||||
|
nNeeded = MultiByteToWideChar(CP_UTF8, 0, this->c_str(), (int)this->length(), buf, nNeeded);
|
||||||
|
if (nNeeded)
|
||||||
|
{
|
||||||
|
res = buf;
|
||||||
|
bConverted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bSuccess)
|
||||||
|
{
|
||||||
|
*bSuccess = bConverted;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,48 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#pragma warning(disable:4786)
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <list>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <windef.h>
|
|
||||||
|
|
||||||
#ifdef _UNICODE
|
|
||||||
typedef std::wstring tstring;
|
|
||||||
#else
|
|
||||||
typedef std::string tstring;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class stdstr;
|
class stdstr;
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
typedef std::vector<stdstr> strvector;
|
typedef std::vector<stdstr> strvector;
|
||||||
|
|
||||||
class stdstr: public tstring
|
class stdstr :
|
||||||
|
public std::string
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
stdstr();
|
stdstr();
|
||||||
stdstr( const tstring & str );
|
stdstr( const std::string & str );
|
||||||
stdstr( const stdstr & str );
|
stdstr( const stdstr & str );
|
||||||
stdstr( const TCHAR * str );
|
stdstr( const char * str );
|
||||||
// stdstr( const TCHAR * strBuff, size_t buffSize);
|
|
||||||
|
|
||||||
void Format(const TCHAR * strFormat, ...);
|
strvector Tokenize ( char delimiter ) const;
|
||||||
void ArgFormat(const TCHAR * strFormat, va_list & args);
|
strvector Tokenize ( const char * delimiter ) const;
|
||||||
|
void Format ( const char * strFormat, ... );
|
||||||
|
stdstr& ToLower ( void );
|
||||||
|
stdstr& ToUpper ( void );
|
||||||
|
|
||||||
|
void Replace ( const char search, const char replace );
|
||||||
|
void Replace ( const char * search, const char replace );
|
||||||
|
void Replace ( const std::string & search, const std::string & replace );
|
||||||
|
|
||||||
|
stdstr & Trim ( const char * chars2remove = "\t " );
|
||||||
|
stdstr & TrimLeft ( const char * chars2remove = "\t " );
|
||||||
|
stdstr & TrimRight ( const char * chars2remove = "\t " );
|
||||||
|
|
||||||
|
stdstr & FromUTF16 ( const wchar_t * UTF16Source, bool * bSuccess = NULL);
|
||||||
|
std::wstring ToUTF16 ( bool * bSuccess = NULL);
|
||||||
|
|
||||||
|
void ArgFormat( const char * strFormat, va_list & args);
|
||||||
|
|
||||||
//stdstr& operator=(const TCHAR * rhs);
|
|
||||||
void replace(const TCHAR search, const TCHAR replace );
|
|
||||||
void replace(const TCHAR * search, const TCHAR replace );
|
|
||||||
void replace(const tstring& search, const tstring& replace );
|
|
||||||
stdstr& Trim(bool StripEnter = false);
|
|
||||||
stdstr& ToLower(void);
|
|
||||||
stdstr& ToUpper(void);
|
|
||||||
strvector Tokenize(const stdstr& delimiters) const;
|
|
||||||
void TrimLeft (const TCHAR * chars2remove = _T(" "));
|
|
||||||
void TrimRight (const TCHAR * chars2remove = _T(" "));
|
|
||||||
static stdstr toTString(const char *pstrSource);
|
|
||||||
static std::string fromTString(const stdstr &strSource);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class stdstr_f: public stdstr
|
class stdstr_f: public stdstr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
stdstr_f(const TCHAR * strFormat, ...)
|
stdstr_f(const char * strFormat, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, strFormat);
|
va_start(args, strFormat);
|
||||||
|
|
Loading…
Reference in New Issue