Polygon Crucher SDK - Documentation
Documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CXTString< XCHAR > Class Template Reference

CXStringT is the template class for handling strings. More...

Detailed Description

template<class XCHAR>
class CXTString< XCHAR >

CXStringT is the template class for handling strings.

CXStringT is declined and CXStringW (unicode strings) and CXStringA (ansi or utf8 strings).

CXString is the default string class. It depends on the OS:

  • CXString = CXStringW under Windows.
  • CXString = CXStringA under Linux or Macos. In that case, the string are encoded in UTF8.

There are also convenient defines such:

  • LPCWSTR / LPWSTR for a pointer to const wchar_t or wchar_t
  • LPCSTR / LPSTR for a pointer to const char / char

A generic defines is declared and depends on the OS:

  • LPCTSTR / LPTSTR which is a const pointer / pointer on wchar_t * under Windows
  • LPCTSTR / LPTSTR which is a const pointer / pointer on char * under Linux and Macos

CXString contains all needed methods to add, substract, extract, convert, format, scan strings.
XCW2A, XCA2W are convenients class to convert unicode to ansi / utf8 and vice versa.

@template XCHAR is char or wchar_t

#include <XString.h>

Public Member Functions

 CXTString (const CXTString< XCHAR > &str)
 
 CXTString (LPCSTR pszText)
 
 CXTString (LPCWSTR pszText)
 
 CXTString (XCHAR ch, int nLength=1)
 
 CXTString (LPCXSTR pszText, int nLength)
 
CXTString< XCHAR > & operator= (const CXTString< XCHAR > &str)
 
CXTString< XCHAR > & operator= (const XCHAR ch)
 
CXTString< XCHAR > & operator= (const unsigned char *pszText)
 
CXTString< XCHAR > & operator= (LPCSTR pszText)
 
CXTString< XCHAR > & operator= (LPCWSTR pszText)
 
void Copy (LPCXSTR szText, int nCount)
 
bool operator== (LPCXSTR pszText) const
 
bool operator!= (LPCXSTR pszText) const
 
 operator LPCXSTR () const
 
XCHAR operator[] (int nIndex)
 
CXTString< XCHAR > & operator+= (XCHAR ch)
 
CXTString< XCHAR > & operator+= (const CXTString< XCHAR > &str)
 
CXTString< XCHAR > & operator+= (LPCSTR szText)
 
CXTString< XCHAR > & operator+= (LPCWSTR szText)
 
int GetLength () const
 returns the length of the buffer in characters (can be greater than strlen, if set by GetBufferSetLength)
 
void AppendFormat (LPCXSTR pszFormat,...)
 
void AppendFormat (unsigned int nFormatID,...)
 
int Compare (LPCXSTR pszText) const
 
int CompareNoCase (LPCXSTR pszText) const
 
int Delete (int nIndex, int nCount=1)
 
int Find (XCHAR ch, int nIndex=0) const
 
int FindNoCase (XCHAR ch, int nIndex=0) const
 
int Find (LPCXSTR pszText, int nStart=0, bool caseInsensitive=false) const
 
int FindEndPos (LPCXSTR pszText, int nStart=0, bool caseInsensitive=false) const
 
int FindOneOf (LPCXSTR pszText) const
 
int ScanS (LPCXSTR pszFormat,...) const
 
int ScanVS (LPCXSTR pszFormat, va_list args) const
 
int ScanVS (int offsetCount, LPCXSTR pszFormat, va_list args) const
 
void Format (unsigned int nID,...)
 
void Format (LPCXSTR pszFormat,...)
 
void FormatV (LPCXSTR pszFormat, va_list args)
 
XCHAR GetAt (int nIndex) const
 
LPCXSTR GetAtPtr (int nIndex) const
 
LPCXSTR GetConstBuffer (int nMinBufLength=-1)
 
LPXSTR GetBuffer (int nMinBufLength=-1)
 
LPXSTR GetBufferSetLength (int nBufferLength)
 
void ReleaseBuffer (int nNewLength=-1)
 
LPXSTR DetachBuffer ()
 Detach buffer. Caller must free buffer with xfree.
 
void Empty ()
 
int Insert (int nIndex, XCHAR ch)
 
int Insert (int nIndex, const CXTString< XCHAR > &str)
 
bool IsEmpty () const
 
CXTString Left (int nCount) const
 
bool LoadString (unsigned int nID)
 
void MakeLower (int count=-1)
 
void MakeReverse ()
 
void MakeUpper (int count=-1)
 
CXTString Mid (int nFirst, int nCount=-1) const
 
int Remove (XCHAR ch)
 
int Remove (LPCXSTR pszText, bool caseInsensitive=false)
 
int Replace (XCHAR chOld, XCHAR chNew)
 
int Replace (LPCXSTR pszOld, LPCXSTR pszNew)
 
int ReverseFind (XCHAR pszText, int nStart=-1) const
 
int ReverseFind (LPCXSTR pszText, int nStart=-1) const
 
CXTString Right (int nCount) const
 
void SetAt (int nIndex, XCHAR ch)
 
CXTString SpanExcluding (LPCXSTR pszText) const
 
CXTString SpanIncluding (LPCXSTR pszText) const
 
CXTString Tokenize (LPCXSTR pszTokens, int &iStart) const
 
void Trim ()
 Remove left and right space char.
 
void TrimLeft ()
 
void TrimLeft (XCHAR chTarget)
 Remove left specified character.
 
void TrimLeft (LPCXSTR pszTargets)
 Remove any character from pszTargets string on the left side of the string.
 
void TrimRight ()
 
void TrimRight (XCHAR chTarget)
 
void TrimRight (LPCXSTR pszTargets)
 
int Collate (LPCXSTR pszText) const
 
int CollateNoCase (LPCXSTR pszText) const
 
 CXTString (const CStringA &txt)
 
CXTString< XCHAR > & operator= (const CStringA &str)
 
 CXTString (const CStringW &txt)
 
CXTString< XCHAR > & operator= (const CStringW &str)
 

Static Public Member Functions

static xStringEncoding GetDefaultEncoding ()
 

Friends

XSTRING_FRIEND friend DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (const CXTString< XCHAR > &string, LPCXSTR pszText)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (const CXTString< XCHAR > &string, XCHAR ch)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (LPCXSTR pszText, const CXTString< XCHAR > &string)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (char ch, const CXTString< XCHAR > &string)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator< (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator> (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator<= (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator>= (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator< (const CXTString< XCHAR > &string1, LPCXSTR pszText)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator> (const CXTString< XCHAR > &string1, LPCXSTR pszText)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator<= (const CXTString< XCHAR > &string1, LPCXSTR pszText)
 
XSTRING_FRIEND friend DLL_TOOLSFUNCTION bool operator>= (const CXTString< XCHAR > &string1, LPCXSTR pszText)
 
DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (const CXTString< XCHAR > &string, typename CXTString< XCHAR >::LPCXSTR pszText)
 
DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (const CXTString< XCHAR > &string, XCHAR ch)
 
DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (typename CXTString< XCHAR >::LPCXSTR pszText, const CXTString< XCHAR > &string)
 
DLL_TOOLSFUNCTION CXTString< XCHARoperator+ (char ch, const CXTString< XCHAR > &string)
 
DLL_TOOLSFUNCTION bool operator< (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
DLL_TOOLSFUNCTION bool operator> (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
DLL_TOOLSFUNCTION bool operator<= (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
DLL_TOOLSFUNCTION bool operator>= (const CXTString< XCHAR > &string1, const CXTString< XCHAR > &string2)
 
DLL_TOOLSFUNCTION bool operator< (const CXTString< XCHAR > &string1, typename CXTString< XCHAR >::LPCXSTR pszText)
 
DLL_TOOLSFUNCTION bool operator> (const CXTString< XCHAR > &string1, typename CXTString< XCHAR >::LPCXSTR pszText)
 
DLL_TOOLSFUNCTION bool operator<= (const CXTString< XCHAR > &string1, typename CXTString< XCHAR >::LPCXSTR pszText)
 
DLL_TOOLSFUNCTION bool operator>= (const CXTString< XCHAR > &string1, typename CXTString< XCHAR >::LPCXSTR pszText)
 

The documentation for this class was generated from the following file: