Proud::StringT< XCHAR, StringTraits > Class Template Reference

Public Member Functions

 StringT ()
 
 ~StringT ()
 
 StringT (const StringT &src)
 
 StringT (const XCHAR *src, int length=0)
 
bool IsEmpty () const
 
XCHAR operator[] (int offset) const
 
const XCHAR * GetString () const
 
const XCHAR * c_str () const
 
XCHAR * GetBuffer (int length=0)
 
int GetLength () const
 
void SetLength (int length)
 
void Append (const StringT &src)
 
void Append (const XCHAR *src)
 
int Compare (const StringT &src) const
 
int Compare (const XCHAR *src) const
 
int CompareNoCase (const StringT &src) const
 
int CompareNoCase (const XCHAR *src) const
 
void Format (const XCHAR *pszFormat,...)
 
void FormatV (const XCHAR *pszFormat, va_list args)
 
void ReleaseBuffer ()
 
int Replace (XCHAR chOld, XCHAR chNew)
 
int Replace (const XCHAR *pszOld, const XCHAR *pszNew)
 
StringTMakeUpper ()
 
StringTMakeLower ()
 
bool operator== (const StringT &src) const
 
bool operator< (const StringT &src) const
 
bool operator!= (const StringT &src) const
 
bool operator== (const XCHAR *src) const
 
bool operator!= (const XCHAR *src) const
 
StringToperator+= (const StringT &src)
 
StringToperator+= (const XCHAR *src)
 
StringToperator= (const StringT &src)
 
StringToperator= (const XCHAR *src)
 
int Find (XCHAR ch, int iStart=0) const throw ()
 
int FindFromLast (XCHAR ch) const throw ()
 
int Find (const XCHAR *pszSub, int iStart=0) const throw ()
 
StringT Mid (int iFirst) const
 
StringT Mid (int iFirst, int nCount) const
 
StringT Right (int nCount) const
 
StringT Left (int nCount) const
 
StringT Tokenize (const XCHAR *pszTokens, int &iStart) const
 
StringTTrimRight ()
 
StringTTrimLeft ()
 
StringTTrim ()
 
StringTTrim (XCHAR chTarget)
 
StringTTrim (const XCHAR *pszTargets)
 
StringTTrimRight (XCHAR chTarget)
 
StringTTrimRight (const XCHAR *pszTargets)
 
StringTTrimLeft (XCHAR chTarget)
 
StringTTrimLeft (const XCHAR *pszTargets)
 
 operator std::string () const
 
 StringT (const std::string &src)
 
 operator std::wstring () const
 
 StringT (const std::wstring &src)
 

Static Public Member Functions

static StringT NewFormat (const XCHAR *pszFormat,...)
 

Detailed Description

template<typename XCHAR, typename StringTraits>
class Proud::StringT< XCHAR, StringTraits >

Text string class

Constructor & Destructor Documentation

template<typename XCHAR, typename StringTraits>
Proud::StringT< XCHAR, StringTraits >::StringT ( )
inline

Constructor

template<typename XCHAR, typename StringTraits>
Proud::StringT< XCHAR, StringTraits >::~StringT ( )
inline

Destructor

template<typename XCHAR, typename StringTraits>
Proud::StringT< XCHAR, StringTraits >::StringT ( const StringT< XCHAR, StringTraits > &  src)
inline

Gets string that pointed by src

template<typename XCHAR, typename StringTraits>
Proud::StringT< XCHAR, StringTraits >::StringT ( const XCHAR *  src,
int  length = 0 
)
inline

Gets a string

Member Function Documentation

template<typename XCHAR, typename StringTraits>
void Proud::StringT< XCHAR, StringTraits >::Append ( const StringT< XCHAR, StringTraits > &  src)
inline

Adds another text string after text string

template<typename XCHAR, typename StringTraits>
void Proud::StringT< XCHAR, StringTraits >::Append ( const XCHAR *  src)
inline

Adds another text string to text string

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::Compare ( const StringT< XCHAR, StringTraits > &  src) const
inline

Compare this objective’s string to string that src indicates. If this objective’s string is smaller than src, negative number will be returned (if same, 0 will be returned & if it is bigger than src, positive number will be returned).

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::Compare ( const XCHAR *  src) const
inline

Compare this objective’s string to string that src indicates. If this objective’s string is smaller than src, negative number will be returned (if same, 0 will be returned & if it is bigger than src, positive number will be returned).

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::CompareNoCase ( const StringT< XCHAR, StringTraits > &  src) const
inline

Compare this objective’s string to string that src indicates. If this objective’s string is smaller than src, negative number will be returned (if same, 0 will be returned & if it is bigger than src, positive number will be returned). But, not classify capital and small letter.

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::CompareNoCase ( const XCHAR *  src) const
inline

Compare this objective’s string to string that src indicates. If this objective’s string is smaller than src, negative number will be returned (if same, 0 will be returned & if it is bigger than src, positive number will be returned). But, not classify capital and small letter.

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::Find ( XCHAR  ch,
int  iStart = 0 
) const throw ()
inline

Finds the location of the character that is pointed by ch through searching from 'iStart'th character of text string. Returns -1 when not found.

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::Find ( const XCHAR *  pszSub,
int  iStart = 0 
) const throw ()
inline

Finds the location of the character that is pointed by pszSub through searching from 'iStart'th character of text string. Returns -1 when not found.

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::FindFromLast ( XCHAR  ch) const throw ()
inline
문자열의 끝에서부터 원하는 글자를 찾습니다.
Parameters
ch찾을 글자
Returns
찾은 글자의 인덱스. 못 찾으면 음수입니다.
template<typename XCHAR, typename StringTraits>
void Proud::StringT< XCHAR, StringTraits >::Format ( const XCHAR *  pszFormat,
  ... 
)
inline

Creates text string as printf (Please refer Creating a string(format))

template<typename XCHAR, typename StringTraits>
void Proud::StringT< XCHAR, StringTraits >::FormatV ( const XCHAR *  pszFormat,
va_list  args 
)
inline

Creates text string as printf (Please refer Creating a string(format))

template<typename XCHAR, typename StringTraits>
XCHAR* Proud::StringT< XCHAR, StringTraits >::GetBuffer ( int  length = 0)
inline

Method used to access string pointer to read from and write to string data.

Proud::String a = L"abc";
wchar_t* pa = a.GetBuffer(100);
_wsprintf(pa, L"%d", 123);

Better usage example

Proud::String a = L"abc";
Proud::StrBuf pa(a, 100);
_wsprintf(pa, L"%d", 123);

Example for read-only access

Proud::String a = L"abc";
wchar_t* pa = a;
template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::GetLength ( ) const
inline

Gets length of string.

Returns
length Number of characters if wchar_t is used, number of bytes if char is used, regardless of multibyte or unicode encoding.
template<typename XCHAR, typename StringTraits>
const XCHAR* Proud::StringT< XCHAR, StringTraits >::GetString ( ) const
inline

Let's read text string data

template<typename XCHAR, typename StringTraits>
bool Proud::StringT< XCHAR, StringTraits >::IsEmpty ( ) const
inline

Is it an empty string ?

template<typename XCHAR, typename StringTraits>
StringT Proud::StringT< XCHAR, StringTraits >::Left ( int  nCount) const
inline

Returns the text stings that are collected from LHS to the point where the amount of characters become nCount in text string.

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::MakeLower ( )
inline

De-capitalize text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::MakeUpper ( )
inline

Capitalizes text string

template<typename XCHAR, typename StringTraits>
StringT Proud::StringT< XCHAR, StringTraits >::Mid ( int  iFirst) const
inline

Returns the characters collected from the location where pointed by iFirst to the end in text string.

template<typename XCHAR, typename StringTraits>
StringT Proud::StringT< XCHAR, StringTraits >::Mid ( int  iFirst,
int  nCount 
) const
inline

Returns the characters collected from the location where pointed by iFirst to the point where the amount of characters become nCount in text string.

template<typename XCHAR, typename StringTraits>
static StringT Proud::StringT< XCHAR, StringTraits >::NewFormat ( const XCHAR *  pszFormat,
  ... 
)
inlinestatic

It performs the same function as the Format method, but it is a static method and returns a new object.

template<typename XCHAR, typename StringTraits>
bool Proud::StringT< XCHAR, StringTraits >::operator!= ( const StringT< XCHAR, StringTraits > &  src) const
inline

Comparison operator

template<typename XCHAR, typename StringTraits>
bool Proud::StringT< XCHAR, StringTraits >::operator!= ( const XCHAR *  src) const
inline

Comparison operator

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::operator+= ( const StringT< XCHAR, StringTraits > &  src)
inline

Text string adding operator

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::operator+= ( const XCHAR *  src)
inline

Text string adding operator

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::operator= ( const StringT< XCHAR, StringTraits > &  src)
inline

String copy assignment operator

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::operator= ( const XCHAR *  src)
inline

String copy assignment operator

template<typename XCHAR, typename StringTraits>
bool Proud::StringT< XCHAR, StringTraits >::operator== ( const StringT< XCHAR, StringTraits > &  src) const
inline

Comparison operator

template<typename XCHAR, typename StringTraits>
bool Proud::StringT< XCHAR, StringTraits >::operator== ( const XCHAR *  src) const
inline

Comparison operator

template<typename XCHAR, typename StringTraits>
void Proud::StringT< XCHAR, StringTraits >::ReleaseBuffer ( )
inline

Once GetBuffer is called then this must end to finalize. Otherwise, the exact length of text string may not be acquired. Please refer GetBuffer description

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::Replace ( XCHAR  chOld,
XCHAR  chNew 
)
inline

Among text strings, replace the character pointed by chOld with the character pointed by chNew.

template<typename XCHAR, typename StringTraits>
int Proud::StringT< XCHAR, StringTraits >::Replace ( const XCHAR *  pszOld,
const XCHAR *  pszNew 
)
inline

Among text strings, replace the character pointed by pszOld with the character pointed by pszNew.

template<typename XCHAR, typename StringTraits>
StringT Proud::StringT< XCHAR, StringTraits >::Right ( int  nCount) const
inline

Returns the text stings that are collected from RHS to the point where the amount of characters become nCount in text string.

template<typename XCHAR, typename StringTraits>
void Proud::StringT< XCHAR, StringTraits >::SetLength ( int  length)
inline

Re-modifies the length of text string

Parameters
lengthNumber of characters if wchar_t is used, number of bytes if char is used, regardless of multibyte or unicode encoding.
template<typename XCHAR, typename StringTraits>
StringT Proud::StringT< XCHAR, StringTraits >::Tokenize ( const XCHAR *  pszTokens,
int &  iStart 
) const
inline

Collects the text strings distinguished by distinguishers pointed by ofpszToken one by one then returns them one by one.

Example:
Proud::String str(L"%First Second#Third");
Proud::String resToken;
int curPos = 0;
resToken= str.Tokenize(L"% #",curPos);
while (resToken != L"")
{
_tprintf_s(L"Resulting token: %s\n", resToken);
resToken = str.Tokenize(L"% #", curPos);
};
template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::Trim ( )
inline

Cuts off the empty characters are left at RHS end and at LHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::Trim ( XCHAR  chTarget)
inline

Cuts off the characters pointed by chTarget and are left at RHS end and at LHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::Trim ( const XCHAR *  pszTargets)
inline

Cuts off the characters pointed by pszTargets and are left at RHS end and at LHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::TrimLeft ( )
inline

Cuts off the empty characters are left at LHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::TrimLeft ( XCHAR  chTarget)
inline

Cuts off the characters pointed by chTarget and are left at LHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::TrimLeft ( const XCHAR *  pszTargets)
inline

Cuts off the characters pointed by pszTargets and are left at RHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::TrimRight ( )
inline

Cuts off the empty characters are left at RHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::TrimRight ( XCHAR  chTarget)
inline

Cuts off the characters pointed by chTarget and are left at RHS end of text string

template<typename XCHAR, typename StringTraits>
StringT& Proud::StringT< XCHAR, StringTraits >::TrimRight ( const XCHAR *  pszTargets)
inline

uts off the characters pointed by pszTargets and are left at RHS end of text string