soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SStringW Class Reference

A class representing an ASCII string. More...

#include <sstringw.h>

Public Types

typedef const wchar_t * pctstr
 
typedef wchar_t _tchar
 
typedef wchar_traits _tchar_traits
 

Public Member Functions

 SStringW ()
 Default constructor.
 
 SStringW (const SStringW &stringSrc)
 Copy constructor.
 
 SStringW (const IStringW *stringSrc)
 Constructor from an IStringW object.
 
 SStringW (wchar_t ch, int nLength=1)
 Constructor from a single character.
 
 SStringW (const wchar_t *psz, int nLength)
 Constructor from a substring of a character array.
 
 SStringW (const wchar_t *psz)
 Constructor from a character array.
 
 ~SStringW ()
 Destructor.
 
int GetLength () SCONST
 Retrieves the length of the string.
 
BOOL IsEmpty () SCONST
 Checks if the string is empty.
 
void Empty ()
 Empties the string.
 
wchar_t GetAt (int nIndex) SCONST
 Retrieves the character at a specified index.
 
void SetAt (int nIndex, wchar_t ch)
 Sets the character at a specified index.
 
const wchar_t * c_str () SCONST
 Retrieves a C-style string representation of the string.
 
int Compare (const wchar_t *psz) SCONST
 Compares the string with another string.
 
int CompareNoCase (const wchar_t *psz) SCONST
 Compares the string with another string, ignoring case.
 
void TrimBlank ()
 Trims leading and trailing whitespace characters from the string.
 
int InsertChar (int nIndex, wchar_t ch)
 Inserts a character at a specified index.
 
int Insert (int nIndex, const wchar_t *psz)
 Inserts a substring at a specified index.
 
int Delete (int nIndex, int nCount=1)
 Deletes a substring from the string.
 
int ReplaceChar (wchar_t chOld, wchar_t chNew)
 Replaces all occurrences of a character with another character.
 
int Replace (const wchar_t *pszOld, const wchar_t *pszNew)
 Replaces all occurrences of a substring with another substring.
 
int Remove (wchar_t chRemove)
 Removes all occurrences of a character from the string.
 
int FindChar (wchar_t ch, int nStart=0) SCONST
 Finds the first occurrence of a character in the string.
 
int ReverseFind (wchar_t ch) SCONST
 Finds the last occurrence of a character in the string.
 
int Find (const wchar_t *pszSub, int nStart=0) SCONST
 Finds the first occurrence of a substring in the string.
 
wchar_t * GetBuffer (int nMinBufLength=-1)
 Retrieves a modifiable buffer for the string.
 
void ReleaseBuffer (int nNewLength=-1)
 Releases the buffer and sets the new length of the string.
 
wchar_t * GetBufferSetLength (int nNewLength)
 Retrieves a modifiable buffer for the string and sets the new length.
 
void SetLength (int nLength)
 Sets the length of the string.
 
void Copy (const IStringW *src)
 Copies the contents of another string into this string.
 
void Assign (LPCWSTR src)
 Assigns a character array to the string.
 
void Assign2 (LPCWSTR src, int nLen)
 Assigns a substring of a character array to the string.
 
LPVOID GetPrivData () SCONST
 Retrieves private data associated with the string.
 
void ToUpper () OVERRIDE
 Converts the string to uppercase.
 
void ToLower () OVERRIDE
 Converts the string to lowercase.
 
void TrimRight (wchar_t chTarget=VK_SPACE) OVERRIDE
 Trims trailing whitespace characters from the string.
 
void TrimLeft (wchar_t chTarget=VK_SPACE) OVERRIDE
 Trims leading whitespace characters from the string.
 
void Trim (wchar_t chTarget=VK_SPACE) OVERRIDE
 Trims leading and trailing whitespace characters from the string.
 
void AppendChar (wchar_t ch) OVERRIDE
 Appends a character to the string.
 
void AppendStr (const wchar_t *pszStr, int nLen=-1) OVERRIDE
 Appends a substring to the string.
 
void Release () OVERRIDE
 Releases the string and its resources.
 
UINT ToUint () SCONST OVERRIDE
 Converts the string to an unsigned integer.
 
long ToLong () SCONST OVERRIDE
 Converts the string to a long integer.
 
int ToInt () SCONST OVERRIDE
 Converts the string to an integer.
 
float ToFloat () SCONST OVERRIDE
 Converts the string to a float.
 
double ToDouble () SCONST OVERRIDE
 Converts the string to a double.
 
BOOL ToBool () SCONST OVERRIDE
 Converts the string to a boolean.
 
SStringW Mid (int nFirst) const
 Extracts a substring from the string.
 
SStringW Mid (int nFirst, int nCount) const
 Extracts a substring from the string.
 
SStringW Right (int nCount) const
 Extracts the rightmost part of the string.
 
SStringW Left (int nCount) const
 Extracts the leftmost part of the string.
 
SStringWMakeUpper ()
 Converts the string to uppercase.
 
SStringWMakeLower ()
 Converts the string to lowercase.
 
bool StartsWith (const SStringW &prefix, bool IgnoreCase=false) const
 Checks if the string starts with a specified prefix.
 
bool EndsWith (const SStringW &suffix, bool IgnoreCase=false) const
 Checks if the string ends with a specified suffix.
 
BOOL LoadString (UINT nID, HINSTANCE hInst)
 Loads a string resource from a module.
 
BOOL __cdecl Format (HINSTANCE hInst, UINT nFormatID,...)
 Formats a string using a format string and variable arguments.
 
void __cdecl AppendFormat (HINSTANCE hInst, UINT nFormatID,...)
 Appends formatted data to the string using a format string and variable arguments.
 
SStringW __cdecl Format (const wchar_t *pszFormat,...)
 Formats a string using a format string and variable arguments.
 
SStringW __cdecl AppendFormat (const wchar_t *pszFormat,...)
 Appends formatted data to the string using a format string and variable arguments.
 
 operator const wchar_t * () const
 Converts the string to a C-style string.
 
wchar_t operator[] (int nIndex) const
 Retrieves the character at a specified index.
 
SStringWoperator= (const SStringW &stringSrc)
 Overloaded assignment operator from another SStringW object.
 
SStringWoperator= (const wchar_t *psz)
 Overloaded assignment operator from a character array.
 
const SStringWoperator= (wchar_t ch)
 Overloaded assignment operator from a single character.
 
const SStringWoperator+= (const wchar_t *psz)
 Overloaded concatenation operator with a character array.
 
const SStringWoperator+= (wchar_t ch)
 Overloaded concatenation operator with a single character.
 
const SStringWoperator+= (const SStringW &src)
 Overloaded concatenation operator with another SStringW object.
 
SStringWAppend (const SStringW &src)
 Appends another SStringW object to the string.
 

Static Public Member Functions

static bool IsBlankChar (const wchar_t &c)
 Checks if a character is a blank character.
 

Protected Member Functions

int GetAllocLength () const
 Retrieves the allocated length of the string buffer.
 
void Preallocate (int nLength)
 Preallocates memory for the string buffer.
 
void FreeExtra ()
 Frees any extra allocated memory in the string buffer.
 
TStringData * GetData () const
 Retrieves the data structure of the string.
 
void Init ()
 Initializes the string.
 
void InitFromIString (const IStringW *stringSrc)
 Initializes the string from an IStringW object.
 
BOOL _Format (const wchar_t *pszFormat, va_list &args)
 Formats a string using a format string and variable arguments.
 
void _AppendFormat (const wchar_t *pszFormat, va_list &args)
 Appends formatted data to the string using a format string and variable arguments.
 
void AllocCopy (SStringW &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
 Allocates and copies a substring of the string.
 
void AssignCopy (int nSrcLen, const wchar_t *pszSrcData)
 Assigns a substring of a character array to the string.
 
bool ConcatCopy (int nSrc1Len, const wchar_t *pszSrc1Data, int nSrc2Len, const wchar_t *pszSrc2Data)
 Concatenates two substrings and copies the result to the string.
 
void ConcatInPlace (int nSrcLen, const wchar_t *pszSrcData)
 Concatenates a substring to the string in place.
 
void CopyBeforeWrite ()
 Copies the string before writing to it.
 
bool AllocBeforeWrite (int nLen)
 Allocates memory for the string before writing to it.
 
bool AllocBuffer (int nLength)
 Allocates memory for the string buffer.
 
bool ReallocBuffer (int nNewLength)
 Reallocates memory for the string buffer.
 
void _ReleaseData ()
 Releases the data structure of the string.
 

Static Protected Member Functions

static int SafeStrlen (const wchar_t *psz)
 Computes the length of a null-terminated string safely.
 
static TStringData * AllocData (int nLength, TStringData *pOldData=NULL)
 Allocates a new data structure for the string.
 
static void ReleaseData (TStringData *pData)
 Releases a data structure.
 

Protected Attributes

wchar_t * m_pszData
 Pointer to the ref counted string data.
 

Friends

bool __stdcall operator== (const SStringW &s1, const SStringW &s2)
 Overloaded equality operator between two SStringW objects.
 
bool __stdcall operator== (const SStringW &s1, const wchar_t *s2)
 Overloaded equality operator between an SStringW object and a character array.
 
bool __stdcall operator== (const wchar_t *s1, const SStringW &s2)
 Overloaded equality operator between a character array and an SStringW object.
 
bool __stdcall operator!= (const SStringW &s1, const SStringW &s2)
 Overloaded inequality operator between two SStringW objects.
 
bool __stdcall operator!= (const SStringW &s1, const wchar_t *s2)
 Overloaded inequality operator between an SStringW object and a character array.
 
bool __stdcall operator!= (const wchar_t *s1, const SStringW &s2)
 Overloaded inequality operator between a character array and an SStringW object.
 
bool __stdcall operator< (const SStringW &s1, const SStringW &s2)
 Overloaded less-than operator between two SStringW objects.
 
bool __stdcall operator< (const SStringW &s1, const wchar_t *s2)
 Overloaded less-than operator between an SStringW object and a character array.
 
bool __stdcall operator< (const wchar_t *s1, const SStringW &s2)
 Overloaded less-than operator between a character array and an SStringW object.
 
bool __stdcall operator> (const SStringW &s1, const SStringW &s2)
 Overloaded greater-than operator between two SStringW objects.
 
bool __stdcall operator> (const SStringW &s1, const wchar_t *s2)
 Overloaded greater-than operator between an SStringW object and a character array.
 
bool __stdcall operator> (const wchar_t *s1, const SStringW &s2)
 Overloaded greater-than operator between a character array and an SStringW object.
 
bool __stdcall operator<= (const SStringW &s1, const SStringW &s2)
 Overloaded less-than-or-equal-to operator between two SStringW objects.
 
bool __stdcall operator<= (const SStringW &s1, const wchar_t *s2)
 Overloaded less-than-or-equal-to operator between an SStringW object and a character array.
 
bool __stdcall operator<= (const wchar_t *s1, const SStringW &s2)
 Overloaded less-than-or-equal-to operator between a character array and an SStringW object.
 
bool __stdcall operator>= (const SStringW &s1, const SStringW &s2)
 Overloaded greater-than-or-equal-to operator between two SStringW objects.
 
bool __stdcall operator>= (const SStringW &s1, const wchar_t *s2)
 Overloaded greater-than-or-equal-to operator between an SStringW object and a character array.
 
bool __stdcall operator>= (const wchar_t *s1, const SStringW &s2)
 Overloaded greater-than-or-equal-to operator between a character array and an SStringW object.
 
SStringW __stdcall operator+ (const SStringW &string1, const SStringW &string2)
 Overloaded addition operator between two SStringW objects.
 
SStringW __stdcall operator+ (const SStringW &string, const wchar_t *psz)
 Overloaded addition operator between an SStringW object and a character array.
 
SStringW __stdcall operator+ (const wchar_t *psz, const SStringW &string)
 Overloaded addition operator between a character array and an SStringW object.
 
SStringW __stdcall operator+ (const SStringW &string1, wchar_t ch)
 Overloaded addition operator between an SStringW object and a single character.
 
SStringW __stdcall operator+ (wchar_t ch, const SStringW &string)
 Overloaded addition operator between a single character and an SStringW object.
 

Detailed Description

A class representing an ASCII string.

Definition at line 95 of file sstringw.h.

Member Typedef Documentation

◆ _tchar

typedef wchar_t SStringW::_tchar

Definition at line 99 of file sstringw.h.

◆ _tchar_traits

Definition at line 100 of file sstringw.h.

◆ pctstr

typedef const wchar_t* SStringW::pctstr

Definition at line 98 of file sstringw.h.

Constructor & Destructor Documentation

◆ SStringW() [1/6]

SStringW::SStringW ( )

Default constructor.

Definition at line 1181 of file sstringw.cpp.

◆ SStringW() [2/6]

SStringW::SStringW ( const SStringW & stringSrc)

Copy constructor.

Parameters
stringSrcThe string to copy.

Definition at line 1176 of file sstringw.cpp.

◆ SStringW() [3/6]

SStringW::SStringW ( const IStringW * stringSrc)

Constructor from an IStringW object.

Parameters
stringSrcThe string to copy.

Definition at line 1171 of file sstringw.cpp.

◆ SStringW() [4/6]

SStringW::SStringW ( wchar_t ch,
int nLength = 1 )

Constructor from a single character.

Parameters
chThe character to initialize the string with.
nLengthThe number of times to repeat the character.

Definition at line 1140 of file sstringw.cpp.

◆ SStringW() [5/6]

SStringW::SStringW ( const wchar_t * psz,
int nLength )

Constructor from a substring of a character array.

Parameters
pszThe character array.
nLengthThe length of the substring.

Definition at line 1129 of file sstringw.cpp.

◆ SStringW() [6/6]

SStringW::SStringW ( const wchar_t * psz)

Constructor from a character array.

Parameters
pszThe character array.

Definition at line 1118 of file sstringw.cpp.

◆ ~SStringW()

SStringW::~SStringW ( )

Destructor.

Definition at line 1110 of file sstringw.cpp.

Member Function Documentation

◆ _AppendFormat()

void SStringW::_AppendFormat ( const wchar_t * pszFormat,
va_list & args )
protected

Appends formatted data to the string using a format string and variable arguments.

Parameters
pszFormatThe format string.
argsThe variable arguments list.

Definition at line 324 of file sstringw.cpp.

◆ _Format()

BOOL SStringW::_Format ( const wchar_t * pszFormat,
va_list & args )
protected

Formats a string using a format string and variable arguments.

Parameters
pszFormatThe format string.
argsThe variable arguments list.
Returns
TRUE if the string was successfully formatted, FALSE otherwise.

Definition at line 338 of file sstringw.cpp.

◆ _ReleaseData()

void SStringW::_ReleaseData ( )
protected

Releases the data structure of the string.

Definition at line 169 of file sstringw.cpp.

◆ AllocBeforeWrite()

bool SStringW::AllocBeforeWrite ( int nLen)
protected

Allocates memory for the string before writing to it.

Parameters
nLenThe length to allocate.
Returns
TRUE if the allocation was successful, FALSE otherwise.

Definition at line 221 of file sstringw.cpp.

◆ AllocBuffer()

bool SStringW::AllocBuffer ( int nLength)
protected

Allocates memory for the string buffer.

Parameters
nLengthThe length to allocate.
Returns
TRUE if the allocation was successful, FALSE otherwise.

Definition at line 210 of file sstringw.cpp.

◆ AllocCopy()

void SStringW::AllocCopy ( SStringW & dest,
int nCopyLen,
int nCopyIndex,
int nExtraLen ) const
protected

Allocates and copies a substring of the string.

Parameters
destThe destination string.
nCopyLenThe length of the substring to copy.
nCopyIndexThe starting index of the substring.
nExtraLenThe extra length to allocate.

Definition at line 305 of file sstringw.cpp.

◆ AllocData()

TStringData * SStringW::AllocData ( int nLength,
TStringData * pOldData = NULL )
staticprotected

Allocates a new data structure for the string.

Parameters
nLengthThe length to allocate.
pOldDataThe old data structure to reuse (optional).
Returns
A pointer to the new data structure.

Definition at line 142 of file sstringw.cpp.

◆ Append()

SStringW & SStringW::Append ( const SStringW & src)

Appends another SStringW object to the string.

Parameters
srcThe string to append.
Returns
A reference to the modified string.

Definition at line 939 of file sstringw.cpp.

◆ AppendChar()

void SStringW::AppendChar ( wchar_t ch)

Appends a character to the string.

Parameters
chThe character to append.

Definition at line 952 of file sstringw.cpp.

◆ AppendFormat() [1/2]

SStringW __cdecl SStringW::AppendFormat ( const wchar_t * pszFormat,
... )

Appends formatted data to the string using a format string and variable arguments.

Parameters
pszFormatThe format string.
...The variable arguments list.
Returns
The modified string.

Definition at line 460 of file sstringw.cpp.

◆ AppendFormat() [2/2]

void __cdecl SStringW::AppendFormat ( HINSTANCE hInst,
UINT nFormatID,
... )

Appends formatted data to the string using a format string and variable arguments.

Parameters
hInstThe handle to the module.
nFormatIDThe resource identifier of the format string.
...The variable arguments list.

Definition at line 469 of file sstringw.cpp.

◆ AppendStr()

void SStringW::AppendStr ( const wchar_t * pszStr,
int nLen = -1 )

Appends a substring to the string.

Parameters
pszStrThe substring to append.
nLenThe length of the substring.

Definition at line 946 of file sstringw.cpp.

◆ Assign()

void SStringW::Assign ( LPCWSTR src)

Assigns a character array to the string.

Parameters
srcThe character array to assign.

Definition at line 1093 of file sstringw.cpp.

◆ Assign2()

void SStringW::Assign2 ( LPCWSTR src,
int nLen )

Assigns a substring of a character array to the string.

Parameters
srcThe character array to assign.
nLenThe length of the substring.

Definition at line 1098 of file sstringw.cpp.

◆ AssignCopy()

void SStringW::AssignCopy ( int nSrcLen,
const wchar_t * pszSrcData )
protected

Assigns a substring of a character array to the string.

Parameters
nSrcLenThe length of the substring.
pszSrcDataThe character array to assign from.

Definition at line 295 of file sstringw.cpp.

◆ c_str()

const wchar_t * SStringW::c_str ( )

Retrieves a C-style string representation of the string.

Returns
A pointer to the C-style string.

Definition at line 1007 of file sstringw.cpp.

◆ Compare()

int SStringW::Compare ( const wchar_t * psz)

Compares the string with another string.

Parameters
pszThe string to compare with.
Returns
An integer less than, equal to, or greater than zero if the string is found, respectively, to be less than, to match, or be greater than psz.

Definition at line 934 of file sstringw.cpp.

◆ CompareNoCase()

int SStringW::CompareNoCase ( const wchar_t * psz)

Compares the string with another string, ignoring case.

Parameters
pszThe string to compare with.
Returns
An integer less than, equal to, or greater than zero if the string is found, respectively, to be less than, to match, or be greater than psz.

Definition at line 929 of file sstringw.cpp.

◆ ConcatCopy()

bool SStringW::ConcatCopy ( int nSrc1Len,
const wchar_t * pszSrc1Data,
int nSrc2Len,
const wchar_t * pszSrc2Data )
protected

Concatenates two substrings and copies the result to the string.

Parameters
nSrc1LenThe length of the first substring.
pszSrc1DataThe first substring.
nSrc2LenThe length of the second substring.
pszSrc2DataThe second substring.
Returns
TRUE if the concatenation was successful, FALSE otherwise.

Definition at line 275 of file sstringw.cpp.

◆ ConcatInPlace()

void SStringW::ConcatInPlace ( int nSrcLen,
const wchar_t * pszSrcData )
protected

Concatenates a substring to the string in place.

Parameters
nSrcLenThe length of the substring.
pszSrcDataThe substring to concatenate.

Definition at line 246 of file sstringw.cpp.

◆ Copy()

void SStringW::Copy ( const IStringW * src)

Copies the contents of another string into this string.

Parameters
srcThe string to copy from.

Definition at line 1069 of file sstringw.cpp.

◆ CopyBeforeWrite()

void SStringW::CopyBeforeWrite ( )
protected

Copies the string before writing to it.

Definition at line 234 of file sstringw.cpp.

◆ Delete()

int SStringW::Delete ( int nIndex,
int nCount = 1 )

Deletes a substring from the string.

Parameters
nIndexThe index at which to start deletion.
nCountThe number of characters to delete.
Returns
The new length of the string.

Definition at line 662 of file sstringw.cpp.

◆ Empty()

void SStringW::Empty ( )

Empties the string.

Definition at line 1041 of file sstringw.cpp.

◆ EndsWith()

bool SStringW::EndsWith ( const SStringW & suffix,
bool IgnoreCase = false ) const

Checks if the string ends with a specified suffix.

Parameters
suffixThe suffix to check.
IgnoreCaseWhether the comparison should be case-insensitive.
Returns
TRUE if the string ends with the suffix, FALSE otherwise.

Definition at line 736 of file sstringw.cpp.

◆ Find()

int SStringW::Find ( const wchar_t * pszSub,
int nStart = 0 )

Finds the first occurrence of a substring in the string.

Parameters
pszSubThe substring to find.
nStartThe index at which to start the search.
Returns
The index of the first occurrence of the substring, or -1 if not found.

Definition at line 516 of file sstringw.cpp.

◆ FindChar()

int SStringW::FindChar ( wchar_t ch,
int nStart = 0 )

Finds the first occurrence of a character in the string.

Parameters
chThe character to find.
nStartThe index at which to start the search.
Returns
The index of the first occurrence of the character, or -1 if not found.

Definition at line 529 of file sstringw.cpp.

◆ Format() [1/2]

SStringW __cdecl SStringW::Format ( const wchar_t * pszFormat,
... )

Formats a string using a format string and variable arguments.

Parameters
pszFormatThe format string.
...The variable arguments list.
Returns
The formatted string.

Definition at line 481 of file sstringw.cpp.

◆ Format() [2/2]

BOOL __cdecl SStringW::Format ( HINSTANCE hInst,
UINT nFormatID,
... )

Formats a string using a format string and variable arguments.

Parameters
hInstThe handle to the module.
nFormatIDThe resource identifier of the format string.
...The variable arguments list.
Returns
TRUE if the string was successfully formatted, FALSE otherwise.

Definition at line 490 of file sstringw.cpp.

◆ FreeExtra()

void SStringW::FreeExtra ( )
protected

Frees any extra allocated memory in the string buffer.

Definition at line 383 of file sstringw.cpp.

◆ GetAllocLength()

int SStringW::GetAllocLength ( ) const
protected

Retrieves the allocated length of the string buffer.

Returns
The allocated length of the string buffer.

Definition at line 377 of file sstringw.cpp.

◆ GetAt()

wchar_t SStringW::GetAt ( int nIndex)

Retrieves the character at a specified index.

Parameters
nIndexThe index of the character.
Returns
The character at the specified index.

Definition at line 1034 of file sstringw.cpp.

◆ GetBuffer()

wchar_t * SStringW::GetBuffer ( int nMinBufLength = -1)

Retrieves a modifiable buffer for the string.

Parameters
nMinBufLengthThe minimum buffer length.
Returns
A pointer to the buffer.

Definition at line 439 of file sstringw.cpp.

◆ GetBufferSetLength()

wchar_t * SStringW::GetBufferSetLength ( int nNewLength)

Retrieves a modifiable buffer for the string and sets the new length.

Parameters
nNewLengthThe new length of the string.
Returns
A pointer to the buffer.

Definition at line 414 of file sstringw.cpp.

◆ GetData()

TStringData * SStringW::GetData ( ) const
protected

Retrieves the data structure of the string.

Returns
A pointer to the data structure.

Definition at line 366 of file sstringw.cpp.

◆ GetLength()

int SStringW::GetLength ( )

Retrieves the length of the string.

Returns
The length of the string.

Definition at line 1064 of file sstringw.cpp.

◆ GetPrivData()

LPVOID SStringW::GetPrivData ( )

Retrieves private data associated with the string.

Returns
A pointer to the private data.

Definition at line 1103 of file sstringw.cpp.

◆ Init()

void SStringW::Init ( )
protected

Initializes the string.

Definition at line 361 of file sstringw.cpp.

◆ InitFromIString()

void SStringW::InitFromIString ( const IStringW * stringSrc)
protected

Initializes the string from an IStringW object.

Parameters
stringSrcThe IStringW object to initialize from.

Definition at line 1154 of file sstringw.cpp.

◆ Insert()

int SStringW::Insert ( int nIndex,
const wchar_t * psz )

Inserts a substring at a specified index.

Parameters
nIndexThe index at which to insert the substring.
pszThe substring to insert.
Returns
The new length of the string.

Definition at line 683 of file sstringw.cpp.

◆ InsertChar()

int SStringW::InsertChar ( int nIndex,
wchar_t ch )

Inserts a character at a specified index.

Parameters
nIndexThe index at which to insert the character.
chThe character to insert.
Returns
The new length of the string.

Definition at line 711 of file sstringw.cpp.

◆ IsBlankChar()

bool SStringW::IsBlankChar ( const wchar_t & c)
static

Checks if a character is a blank character.

Parameters
cThe character to check.
Returns
TRUE if the character is a blank character, FALSE otherwise.

Definition at line 788 of file sstringw.cpp.

◆ IsEmpty()

BOOL SStringW::IsEmpty ( )

Checks if the string is empty.

Returns
TRUE if the string is empty, FALSE otherwise.

Definition at line 1059 of file sstringw.cpp.

◆ Left()

SStringW SStringW::Left ( int nCount) const

Extracts the leftmost part of the string.

Parameters
nCountThe length of the substring.
Returns
The extracted substring.

Definition at line 879 of file sstringw.cpp.

◆ LoadString()

BOOL SStringW::LoadString ( UINT nID,
HINSTANCE hInst )

Loads a string resource from a module.

Parameters
nIDThe resource identifier.
hInstThe handle to the module.
Returns
TRUE if the string was successfully loaded, FALSE otherwise.

Definition at line 506 of file sstringw.cpp.

◆ MakeLower()

SStringW & SStringW::MakeLower ( )

Converts the string to lowercase.

Returns
A reference to the modified string.

Definition at line 869 of file sstringw.cpp.

◆ MakeUpper()

SStringW & SStringW::MakeUpper ( )

Converts the string to uppercase.

Returns
A reference to the modified string.

Definition at line 874 of file sstringw.cpp.

◆ Mid() [1/2]

SStringW SStringW::Mid ( int nFirst) const

Extracts a substring from the string.

Parameters
nFirstThe starting index of the substring.
Returns
The extracted substring.

Definition at line 924 of file sstringw.cpp.

◆ Mid() [2/2]

SStringW SStringW::Mid ( int nFirst,
int nCount ) const

Extracts a substring from the string.

Parameters
nFirstThe starting index of the substring.
nCountThe length of the substring.
Returns
The extracted substring.

Definition at line 905 of file sstringw.cpp.

◆ operator const wchar_t *()

SStringW::operator const wchar_t * ( ) const

Converts the string to a C-style string.

Returns
A pointer to the C-style string.

Definition at line 1012 of file sstringw.cpp.

◆ operator+=() [1/3]

const SStringW & SStringW::operator+= ( const SStringW & src)

Overloaded concatenation operator with another SStringW object.

Parameters
srcThe string to concatenate.
Returns
A reference to the modified string.

Definition at line 957 of file sstringw.cpp.

◆ operator+=() [2/3]

const SStringW & SStringW::operator+= ( const wchar_t * psz)

Overloaded concatenation operator with a character array.

Parameters
pszThe character array to concatenate.
Returns
A reference to the modified string.

Definition at line 967 of file sstringw.cpp.

◆ operator+=() [3/3]

const SStringW & SStringW::operator+= ( wchar_t ch)

Overloaded concatenation operator with a single character.

Parameters
chThe character to concatenate.
Returns
A reference to the modified string.

Definition at line 962 of file sstringw.cpp.

◆ operator=() [1/3]

SStringW & SStringW::operator= ( const SStringW & stringSrc)

Overloaded assignment operator from another SStringW object.

Parameters
stringSrcThe string to assign.
Returns
A reference to the modified string.

Definition at line 985 of file sstringw.cpp.

◆ operator=() [2/3]

SStringW & SStringW::operator= ( const wchar_t * psz)

Overloaded assignment operator from a character array.

Parameters
pszThe character array to assign.
Returns
A reference to the modified string.

Definition at line 978 of file sstringw.cpp.

◆ operator=() [3/3]

const SStringW & SStringW::operator= ( wchar_t ch)

Overloaded assignment operator from a single character.

Parameters
chThe character to assign.
Returns
A reference to the modified string.

Definition at line 972 of file sstringw.cpp.

◆ operator[]()

wchar_t SStringW::operator[] ( int nIndex) const

Retrieves the character at a specified index.

Parameters
nIndexThe index of the character.
Returns
The character at the specified index.

Definition at line 1026 of file sstringw.cpp.

◆ Preallocate()

void SStringW::Preallocate ( int nLength)
protected

Preallocates memory for the string buffer.

Parameters
nLengthThe length to preallocate.

Definition at line 395 of file sstringw.cpp.

◆ ReallocBuffer()

bool SStringW::ReallocBuffer ( int nNewLength)
protected

Reallocates memory for the string buffer.

Parameters
nNewLengthThe new length to allocate.
Returns
TRUE if the reallocation was successful, FALSE otherwise.

Definition at line 180 of file sstringw.cpp.

◆ Release()

void SStringW::Release ( )

Releases the string and its resources.

Definition at line 1186 of file sstringw.cpp.

◆ ReleaseBuffer()

void SStringW::ReleaseBuffer ( int nNewLength = -1)

Releases the buffer and sets the new length of the string.

Parameters
nNewLengthThe new length of the string.

Definition at line 426 of file sstringw.cpp.

◆ ReleaseData()

void SStringW::ReleaseData ( TStringData * pData)
staticprotected

Releases a data structure.

Parameters
pDataThe data structure to release.

Definition at line 133 of file sstringw.cpp.

◆ Remove()

int SStringW::Remove ( wchar_t chRemove)

Removes all occurrences of a character from the string.

Parameters
chRemoveThe character to remove.
Returns
The number of characters removed.

Definition at line 551 of file sstringw.cpp.

◆ Replace()

int SStringW::Replace ( const wchar_t * pszOld,
const wchar_t * pszNew )

Replaces all occurrences of a substring with another substring.

Parameters
pszOldThe substring to replace.
pszNewThe substring to replace with.
Returns
The number of substrings replaced.

Definition at line 575 of file sstringw.cpp.

◆ ReplaceChar()

int SStringW::ReplaceChar ( wchar_t chOld,
wchar_t chNew )

Replaces all occurrences of a character with another character.

Parameters
chOldThe character to replace.
chNewThe character to replace with.
Returns
The number of characters replaced.

Definition at line 636 of file sstringw.cpp.

◆ ReverseFind()

int SStringW::ReverseFind ( wchar_t ch)

Finds the last occurrence of a character in the string.

Parameters
chThe character to find.
Returns
The index of the last occurrence of the character, or -1 if not found.

Definition at line 542 of file sstringw.cpp.

◆ Right()

SStringW SStringW::Right ( int nCount) const

Extracts the rightmost part of the string.

Parameters
nCountThe length of the substring.
Returns
The extracted substring.

Definition at line 892 of file sstringw.cpp.

◆ SafeStrlen()

int SStringW::SafeStrlen ( const wchar_t * psz)
staticprotected

Computes the length of a null-terminated string safely.

Parameters
pszThe string to measure.
Returns
The length of the string.

Definition at line 372 of file sstringw.cpp.

◆ SetAt()

void SStringW::SetAt ( int nIndex,
wchar_t ch )

Sets the character at a specified index.

Parameters
nIndexThe index of the character.
chThe new character value.

Definition at line 1017 of file sstringw.cpp.

◆ SetLength()

void SStringW::SetLength ( int nLength)

Sets the length of the string.

Parameters
nLengthThe new length of the string.

Definition at line 402 of file sstringw.cpp.

◆ StartsWith()

bool SStringW::StartsWith ( const SStringW & prefix,
bool IgnoreCase = false ) const

Checks if the string starts with a specified prefix.

Parameters
prefixThe prefix to check.
IgnoreCaseWhether the comparison should be case-insensitive.
Returns
TRUE if the string starts with the prefix, FALSE otherwise.

Definition at line 749 of file sstringw.cpp.

◆ ToBool()

BOOL SStringW::ToBool ( )

Converts the string to a boolean.

Returns
The boolean value.

Definition at line 1214 of file sstringw.cpp.

◆ ToDouble()

double SStringW::ToDouble ( )

Converts the string to a double.

Returns
The double value.

Definition at line 1210 of file sstringw.cpp.

◆ ToFloat()

float SStringW::ToFloat ( )

Converts the string to a float.

Returns
The float value.

Definition at line 1206 of file sstringw.cpp.

◆ ToInt()

int SStringW::ToInt ( )

Converts the string to an integer.

Returns
The integer value.

Definition at line 1202 of file sstringw.cpp.

◆ ToLong()

long SStringW::ToLong ( )

Converts the string to a long integer.

Returns
The long integer value.

Definition at line 1197 of file sstringw.cpp.

◆ ToLower()

void SStringW::ToLower ( )

Converts the string to lowercase.

Definition at line 853 of file sstringw.cpp.

◆ ToUint()

UINT SStringW::ToUint ( )

Converts the string to an unsigned integer.

Returns
The unsigned integer value.

Definition at line 1192 of file sstringw.cpp.

◆ ToUpper()

void SStringW::ToUpper ( )

Converts the string to uppercase.

Definition at line 861 of file sstringw.cpp.

◆ Trim()

void SStringW::Trim ( wchar_t chTarget = VK_SPACE)

Trims leading and trailing whitespace characters from the string.

Parameters
chTargetThe character to trim.

Definition at line 798 of file sstringw.cpp.

◆ TrimBlank()

void SStringW::TrimBlank ( )

Trims leading and trailing whitespace characters from the string.

Definition at line 762 of file sstringw.cpp.

◆ TrimLeft()

void SStringW::TrimLeft ( wchar_t chTarget = VK_SPACE)

Trims leading whitespace characters from the string.

Parameters
chTargetThe character to trim.

Definition at line 804 of file sstringw.cpp.

◆ TrimRight()

void SStringW::TrimRight ( wchar_t chTarget = VK_SPACE)

Trims trailing whitespace characters from the string.

Parameters
chTargetThe character to trim.

Definition at line 824 of file sstringw.cpp.

Friends And Related Symbol Documentation

◆ operator!= [1/3]

bool __stdcall operator!= ( const SStringW & s1,
const SStringW & s2 )
friend

Overloaded inequality operator between two SStringW objects.

Parameters
s1The first string.
s2The second string.
Returns
TRUE if the strings are not equal, FALSE otherwise.

Definition at line 462 of file sstringw.h.

◆ operator!= [2/3]

bool __stdcall operator!= ( const SStringW & s1,
const wchar_t * s2 )
friend

Overloaded inequality operator between an SStringW object and a character array.

Parameters
s1The string.
s2The character array.
Returns
TRUE if the string and character array are not equal, FALSE otherwise.

Definition at line 471 of file sstringw.h.

◆ operator!= [3/3]

bool __stdcall operator!= ( const wchar_t * s1,
const SStringW & s2 )
friend

Overloaded inequality operator between a character array and an SStringW object.

Parameters
s1The character array.
s2The string.
Returns
TRUE if the character array and string are not equal, FALSE otherwise.

Definition at line 480 of file sstringw.h.

◆ operator+ [1/5]

SStringW __stdcall operator+ ( const SStringW & string,
const wchar_t * psz )
friend

Overloaded addition operator between an SStringW object and a character array.

Parameters
stringThe string.
pszThe character array.
Returns
A new string that is the concatenation of the string and the character array.

Definition at line 608 of file sstringw.h.

◆ operator+ [2/5]

SStringW __stdcall operator+ ( const SStringW & string1,
const SStringW & string2 )
friend

Overloaded addition operator between two SStringW objects.

Parameters
string1The first string.
string2The second string.
Returns
A new string that is the concatenation of the two strings.

Definition at line 597 of file sstringw.h.

◆ operator+ [3/5]

SStringW __stdcall operator+ ( const SStringW & string1,
wchar_t ch )
friend

Overloaded addition operator between an SStringW object and a single character.

Parameters
string1The string.
chThe character.
Returns
A new string that is the concatenation of the string and the character.

Definition at line 632 of file sstringw.h.

◆ operator+ [4/5]

SStringW __stdcall operator+ ( const wchar_t * psz,
const SStringW & string )
friend

Overloaded addition operator between a character array and an SStringW object.

Parameters
pszThe character array.
stringThe string.
Returns
A new string that is the concatenation of the character array and the string.

Definition at line 620 of file sstringw.h.

◆ operator+ [5/5]

SStringW __stdcall operator+ ( wchar_t ch,
const SStringW & string )
friend

Overloaded addition operator between a single character and an SStringW object.

Parameters
chThe character.
stringThe string.
Returns
A new string that is the concatenation of the character and the string.

Definition at line 643 of file sstringw.h.

◆ operator< [1/3]

bool __stdcall operator< ( const SStringW & s1,
const SStringW & s2 )
friend

Overloaded less-than operator between two SStringW objects.

Parameters
s1The first string.
s2The second string.
Returns
TRUE if the first string is less than the second string, FALSE otherwise.

Definition at line 489 of file sstringw.h.

◆ operator< [2/3]

bool __stdcall operator< ( const SStringW & s1,
const wchar_t * s2 )
friend

Overloaded less-than operator between an SStringW object and a character array.

Parameters
s1The string.
s2The character array.
Returns
TRUE if the string is less than the character array, FALSE otherwise.

Definition at line 498 of file sstringw.h.

◆ operator< [3/3]

bool __stdcall operator< ( const wchar_t * s1,
const SStringW & s2 )
friend

Overloaded less-than operator between a character array and an SStringW object.

Parameters
s1The character array.
s2The string.
Returns
TRUE if the character array is less than the string, FALSE otherwise.

Definition at line 507 of file sstringw.h.

◆ operator<= [1/3]

bool __stdcall operator<= ( const SStringW & s1,
const SStringW & s2 )
friend

Overloaded less-than-or-equal-to operator between two SStringW objects.

Parameters
s1The first string.
s2The second string.
Returns
TRUE if the first string is less than or equal to the second string, FALSE otherwise.

Definition at line 543 of file sstringw.h.

◆ operator<= [2/3]

bool __stdcall operator<= ( const SStringW & s1,
const wchar_t * s2 )
friend

Overloaded less-than-or-equal-to operator between an SStringW object and a character array.

Parameters
s1The string.
s2The character array.
Returns
TRUE if the string is less than or equal to the character array, FALSE otherwise.

Definition at line 552 of file sstringw.h.

◆ operator<= [3/3]

bool __stdcall operator<= ( const wchar_t * s1,
const SStringW & s2 )
friend

Overloaded less-than-or-equal-to operator between a character array and an SStringW object.

Parameters
s1The character array.
s2The string.
Returns
TRUE if the character array is less than or equal to the string, FALSE otherwise.

Definition at line 561 of file sstringw.h.

◆ operator== [1/3]

bool __stdcall operator== ( const SStringW & s1,
const SStringW & s2 )
friend

Overloaded equality operator between two SStringW objects.

Parameters
s1The first string.
s2The second string.
Returns
TRUE if the strings are equal, FALSE otherwise.

Definition at line 435 of file sstringw.h.

◆ operator== [2/3]

bool __stdcall operator== ( const SStringW & s1,
const wchar_t * s2 )
friend

Overloaded equality operator between an SStringW object and a character array.

Parameters
s1The string.
s2The character array.
Returns
TRUE if the string and character array are equal, FALSE otherwise.

Definition at line 444 of file sstringw.h.

◆ operator== [3/3]

bool __stdcall operator== ( const wchar_t * s1,
const SStringW & s2 )
friend

Overloaded equality operator between a character array and an SStringW object.

Parameters
s1The character array.
s2The string.
Returns
TRUE if the character array and string are equal, FALSE otherwise.

Definition at line 453 of file sstringw.h.

◆ operator> [1/3]

bool __stdcall operator> ( const SStringW & s1,
const SStringW & s2 )
friend

Overloaded greater-than operator between two SStringW objects.

Parameters
s1The first string.
s2The second string.
Returns
TRUE if the first string is greater than the second string, FALSE otherwise.

Definition at line 516 of file sstringw.h.

◆ operator> [2/3]

bool __stdcall operator> ( const SStringW & s1,
const wchar_t * s2 )
friend

Overloaded greater-than operator between an SStringW object and a character array.

Parameters
s1The string.
s2The character array.
Returns
TRUE if the string is greater than the character array, FALSE otherwise.

Definition at line 525 of file sstringw.h.

◆ operator> [3/3]

bool __stdcall operator> ( const wchar_t * s1,
const SStringW & s2 )
friend

Overloaded greater-than operator between a character array and an SStringW object.

Parameters
s1The character array.
s2The string.
Returns
TRUE if the character array is greater than the string, FALSE otherwise.

Definition at line 534 of file sstringw.h.

◆ operator>= [1/3]

bool __stdcall operator>= ( const SStringW & s1,
const SStringW & s2 )
friend

Overloaded greater-than-or-equal-to operator between two SStringW objects.

Parameters
s1The first string.
s2The second string.
Returns
TRUE if the first string is greater than or equal to the second string, FALSE otherwise.

Definition at line 570 of file sstringw.h.

◆ operator>= [2/3]

bool __stdcall operator>= ( const SStringW & s1,
const wchar_t * s2 )
friend

Overloaded greater-than-or-equal-to operator between an SStringW object and a character array.

Parameters
s1The string.
s2The character array.
Returns
TRUE if the string is greater than or equal to the character array, FALSE otherwise.

Definition at line 579 of file sstringw.h.

◆ operator>= [3/3]

bool __stdcall operator>= ( const wchar_t * s1,
const SStringW & s2 )
friend

Overloaded greater-than-or-equal-to operator between a character array and an SStringW object.

Parameters
s1The character array.
s2The string.
Returns
TRUE if the character array is greater than or equal to the string, FALSE otherwise.

Definition at line 588 of file sstringw.h.

Member Data Documentation

◆ m_pszData

wchar_t* SStringW::m_pszData
protected

Pointer to the ref counted string data.

Definition at line 763 of file sstringw.h.


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