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

A class representing an ASCII string. More...

#include <sstringa.h>

Public Types

typedef const char * pctstr
 
typedef char _tchar
 
typedef char_traits _tchar_traits
 

Public Member Functions

 SStringA ()
 Default constructor.
 
 SStringA (const SStringA &stringSrc)
 Copy constructor.
 
 SStringA (const IStringA *stringSrc)
 Constructor from an IStringA object.
 
 SStringA (char ch, int nLength=1)
 Constructor from a single character.
 
 SStringA (const char *psz, int nLength)
 Constructor from a substring of a character array.
 
 SStringA (const char *psz)
 Constructor from a character array.
 
 ~SStringA ()
 Destructor.
 
int GetLength () SCONST
 Retrieves the length of the string.
 
BOOL IsEmpty () SCONST
 Checks if the string is empty.
 
void Empty ()
 Empties the string.
 
char GetAt (int nIndex) SCONST
 Retrieves the character at a specified index.
 
void SetAt (int nIndex, char ch)
 Sets the character at a specified index.
 
const char * c_str () SCONST
 Retrieves a C-style string representation of the string.
 
int Compare (const char *psz) SCONST
 Compares the string with another string.
 
int CompareNoCase (const char *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, char ch)
 Inserts a character at a specified index.
 
int Insert (int nIndex, const char *psz)
 Inserts a substring at a specified index.
 
int Delete (int nIndex, int nCount=1)
 Deletes a substring from the string.
 
int ReplaceChar (char chOld, char chNew)
 Replaces all occurrences of a character with another character.
 
int Replace (const char *pszOld, const char *pszNew)
 Replaces all occurrences of a substring with another substring.
 
int Remove (char chRemove)
 Removes all occurrences of a character from the string.
 
int FindChar (char ch, int nStart=0) SCONST
 Finds the first occurrence of a character in the string.
 
int ReverseFind (char ch) SCONST
 Finds the last occurrence of a character in the string.
 
int Find (const char *pszSub, int nStart=0) SCONST
 Finds the first occurrence of a substring in the string.
 
char * 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.
 
char * 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 IStringA *src)
 Copies the contents of another string into this string.
 
void Assign (LPCSTR src)
 Assigns a character array to the string.
 
void Assign2 (LPCSTR 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 (char chTarget=VK_SPACE) OVERRIDE
 Trims trailing whitespace characters from the string.
 
void TrimLeft (char chTarget=VK_SPACE) OVERRIDE
 Trims leading whitespace characters from the string.
 
void Trim (char chTarget=VK_SPACE) OVERRIDE
 Trims leading and trailing whitespace characters from the string.
 
void AppendChar (char ch) OVERRIDE
 Appends a character to the string.
 
void AppendStr (const char *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.
 
SStringA Mid (int nFirst) const
 Extracts a substring from the string.
 
SStringA Mid (int nFirst, int nCount) const
 Extracts a substring from the string.
 
SStringA Right (int nCount) const
 Extracts the rightmost part of the string.
 
SStringA Left (int nCount) const
 Extracts the leftmost part of the string.
 
SStringAMakeUpper ()
 Converts the string to uppercase.
 
SStringAMakeLower ()
 Converts the string to lowercase.
 
bool StartsWith (const SStringA &prefix, bool IgnoreCase=false) const
 Checks if the string starts with a specified prefix.
 
bool EndsWith (const SStringA &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.
 
SStringA __cdecl Format (const char *pszFormat,...)
 Formats a string using a format string and variable arguments.
 
SStringA __cdecl AppendFormat (const char *pszFormat,...)
 Appends formatted data to the string using a format string and variable arguments.
 
 operator const char * () const
 Converts the string to a C-style string.
 
char operator[] (int nIndex) const
 Retrieves the character at a specified index.
 
SStringAoperator= (const SStringA &stringSrc)
 Overloaded assignment operator from another SStringA object.
 
SStringAoperator= (const char *psz)
 Overloaded assignment operator from a character array.
 
const SStringAoperator= (char ch)
 Overloaded assignment operator from a single character.
 
const SStringAoperator+= (const char *psz)
 Overloaded concatenation operator with a character array.
 
const SStringAoperator+= (char ch)
 Overloaded concatenation operator with a single character.
 
const SStringAoperator+= (const SStringA &src)
 Overloaded concatenation operator with another SStringA object.
 
SStringAAppend (const SStringA &src)
 Appends another SStringA object to the string.
 

Static Public Member Functions

static bool IsBlankChar (const char &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 IStringA *stringSrc)
 Initializes the string from an IStringA object.
 
BOOL _Format (const char *pszFormat, va_list &args)
 Formats a string using a format string and variable arguments.
 
void _AppendFormat (const char *pszFormat, va_list &args)
 Appends formatted data to the string using a format string and variable arguments.
 
void AllocCopy (SStringA &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
 Allocates and copies a substring of the string.
 
void AssignCopy (int nSrcLen, const char *pszSrcData)
 Assigns a substring of a character array to the string.
 
bool ConcatCopy (int nSrc1Len, const char *pszSrc1Data, int nSrc2Len, const char *pszSrc2Data)
 Concatenates two substrings and copies the result to the string.
 
void ConcatInPlace (int nSrcLen, const char *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 char *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

char * m_pszData
 Pointer to the ref counted string data.
 

Friends

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

Detailed Description

A class representing an ASCII string.

Definition at line 95 of file sstringa.h.

Member Typedef Documentation

◆ _tchar

typedef char SStringA::_tchar

Definition at line 99 of file sstringa.h.

◆ _tchar_traits

Definition at line 100 of file sstringa.h.

◆ pctstr

typedef const char* SStringA::pctstr

Definition at line 98 of file sstringa.h.

Constructor & Destructor Documentation

◆ SStringA() [1/6]

SStringA::SStringA ( )

Default constructor.

Definition at line 1186 of file sstringa.cpp.

◆ SStringA() [2/6]

SStringA::SStringA ( const SStringA & stringSrc)

Copy constructor.

Parameters
stringSrcThe string to copy.

Definition at line 1181 of file sstringa.cpp.

◆ SStringA() [3/6]

SStringA::SStringA ( const IStringA * stringSrc)

Constructor from an IStringA object.

Parameters
stringSrcThe string to copy.

Definition at line 1176 of file sstringa.cpp.

◆ SStringA() [4/6]

SStringA::SStringA ( char 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 1145 of file sstringa.cpp.

◆ SStringA() [5/6]

SStringA::SStringA ( const char * psz,
int nLength )

Constructor from a substring of a character array.

Parameters
pszThe character array.
nLengthThe length of the substring.

Definition at line 1134 of file sstringa.cpp.

◆ SStringA() [6/6]

SStringA::SStringA ( const char * psz)

Constructor from a character array.

Parameters
pszThe character array.

Definition at line 1123 of file sstringa.cpp.

◆ ~SStringA()

SStringA::~SStringA ( )

Destructor.

Definition at line 1114 of file sstringa.cpp.

Member Function Documentation

◆ _AppendFormat()

void SStringA::_AppendFormat ( const char * 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 330 of file sstringa.cpp.

◆ _Format()

BOOL SStringA::_Format ( const char * 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 344 of file sstringa.cpp.

◆ _ReleaseData()

void SStringA::_ReleaseData ( )
protected

Releases the data structure of the string.

Definition at line 175 of file sstringa.cpp.

◆ AllocBeforeWrite()

bool SStringA::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 227 of file sstringa.cpp.

◆ AllocBuffer()

bool SStringA::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 216 of file sstringa.cpp.

◆ AllocCopy()

void SStringA::AllocCopy ( SStringA & 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 311 of file sstringa.cpp.

◆ AllocData()

TStringData * SStringA::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 148 of file sstringa.cpp.

◆ Append()

SStringA & SStringA::Append ( const SStringA & src)

Appends another SStringA object to the string.

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

Definition at line 985 of file sstringa.cpp.

◆ AppendChar()

void SStringA::AppendChar ( char ch)

Appends a character to the string.

Parameters
chThe character to append.

Definition at line 997 of file sstringa.cpp.

◆ AppendFormat() [1/2]

SStringA __cdecl SStringA::AppendFormat ( const char * 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 504 of file sstringa.cpp.

◆ AppendFormat() [2/2]

void __cdecl SStringA::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 513 of file sstringa.cpp.

◆ AppendStr()

void SStringA::AppendStr ( const char * pszStr,
int nLen = -1 )

Appends a substring to the string.

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

Definition at line 991 of file sstringa.cpp.

◆ Assign()

void SStringA::Assign ( LPCSTR src)

Assigns a character array to the string.

Parameters
srcThe character array to assign.

Definition at line 442 of file sstringa.cpp.

◆ Assign2()

void SStringA::Assign2 ( LPCSTR 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 447 of file sstringa.cpp.

◆ AssignCopy()

void SStringA::AssignCopy ( int nSrcLen,
const char * 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 301 of file sstringa.cpp.

◆ c_str()

const char * SStringA::c_str ( )

Retrieves a C-style string representation of the string.

Returns
A pointer to the C-style string.

Definition at line 1052 of file sstringa.cpp.

◆ Compare()

int SStringA::Compare ( const char * 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 980 of file sstringa.cpp.

◆ CompareNoCase()

int SStringA::CompareNoCase ( const char * 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 975 of file sstringa.cpp.

◆ ConcatCopy()

bool SStringA::ConcatCopy ( int nSrc1Len,
const char * pszSrc1Data,
int nSrc2Len,
const char * 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 281 of file sstringa.cpp.

◆ ConcatInPlace()

void SStringA::ConcatInPlace ( int nSrcLen,
const char * pszSrcData )
protected

Concatenates a substring to the string in place.

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

Definition at line 252 of file sstringa.cpp.

◆ Copy()

void SStringA::Copy ( const IStringA * src)

Copies the contents of another string into this string.

Parameters
srcThe string to copy from.

Definition at line 420 of file sstringa.cpp.

◆ CopyBeforeWrite()

void SStringA::CopyBeforeWrite ( )
protected

Copies the string before writing to it.

Definition at line 240 of file sstringa.cpp.

◆ Delete()

int SStringA::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 706 of file sstringa.cpp.

◆ Empty()

void SStringA::Empty ( )

Empties the string.

Definition at line 1086 of file sstringa.cpp.

◆ EndsWith()

bool SStringA::EndsWith ( const SStringA & 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 780 of file sstringa.cpp.

◆ Find()

int SStringA::Find ( const char * 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 560 of file sstringa.cpp.

◆ FindChar()

int SStringA::FindChar ( char 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 573 of file sstringa.cpp.

◆ Format() [1/2]

SStringA __cdecl SStringA::Format ( const char * 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 525 of file sstringa.cpp.

◆ Format() [2/2]

BOOL __cdecl SStringA::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 534 of file sstringa.cpp.

◆ FreeExtra()

void SStringA::FreeExtra ( )
protected

Frees any extra allocated memory in the string buffer.

Definition at line 389 of file sstringa.cpp.

◆ GetAllocLength()

int SStringA::GetAllocLength ( ) const
protected

Retrieves the allocated length of the string buffer.

Returns
The allocated length of the string buffer.

Definition at line 383 of file sstringa.cpp.

◆ GetAt()

char SStringA::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 1079 of file sstringa.cpp.

◆ GetBuffer()

char * SStringA::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 482 of file sstringa.cpp.

◆ GetBufferSetLength()

char * SStringA::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 457 of file sstringa.cpp.

◆ GetData()

TStringData * SStringA::GetData ( ) const
protected

Retrieves the data structure of the string.

Returns
A pointer to the data structure.

Definition at line 372 of file sstringa.cpp.

◆ GetLength()

int SStringA::GetLength ( )

Retrieves the length of the string.

Returns
The length of the string.

Definition at line 1109 of file sstringa.cpp.

◆ GetPrivData()

LPVOID SStringA::GetPrivData ( )

Retrieves private data associated with the string.

Returns
A pointer to the private data.

Definition at line 452 of file sstringa.cpp.

◆ Init()

void SStringA::Init ( )
protected

Initializes the string.

Definition at line 367 of file sstringa.cpp.

◆ InitFromIString()

void SStringA::InitFromIString ( const IStringA * stringSrc)
protected

Initializes the string from an IStringA object.

Parameters
stringSrcThe IStringA object to initialize from.

Definition at line 1159 of file sstringa.cpp.

◆ Insert()

int SStringA::Insert ( int nIndex,
const char * 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 727 of file sstringa.cpp.

◆ InsertChar()

int SStringA::InsertChar ( int nIndex,
char 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 755 of file sstringa.cpp.

◆ IsBlankChar()

bool SStringA::IsBlankChar ( const char & 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 832 of file sstringa.cpp.

◆ IsEmpty()

BOOL SStringA::IsEmpty ( )

Checks if the string is empty.

Returns
TRUE if the string is empty, FALSE otherwise.

Definition at line 1104 of file sstringa.cpp.

◆ Left()

SStringA SStringA::Left ( int nCount) const

Extracts the leftmost part of the string.

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

Definition at line 925 of file sstringa.cpp.

◆ LoadString()

BOOL SStringA::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 550 of file sstringa.cpp.

◆ MakeLower()

SStringA & SStringA::MakeLower ( )

Converts the string to lowercase.

Returns
A reference to the modified string.

Definition at line 913 of file sstringa.cpp.

◆ MakeUpper()

SStringA & SStringA::MakeUpper ( )

Converts the string to uppercase.

Returns
A reference to the modified string.

Definition at line 919 of file sstringa.cpp.

◆ Mid() [1/2]

SStringA SStringA::Mid ( int nFirst) const

Extracts a substring from the string.

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

Definition at line 970 of file sstringa.cpp.

◆ Mid() [2/2]

SStringA SStringA::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 951 of file sstringa.cpp.

◆ operator const char *()

SStringA::operator const char * ( ) const

Converts the string to a C-style string.

Returns
A pointer to the C-style string.

Definition at line 1057 of file sstringa.cpp.

◆ operator+=() [1/3]

const SStringA & SStringA::operator+= ( char ch)

Overloaded concatenation operator with a single character.

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

Definition at line 1007 of file sstringa.cpp.

◆ operator+=() [2/3]

const SStringA & SStringA::operator+= ( const char * psz)

Overloaded concatenation operator with a character array.

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

Definition at line 1012 of file sstringa.cpp.

◆ operator+=() [3/3]

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

Overloaded concatenation operator with another SStringA object.

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

Definition at line 1002 of file sstringa.cpp.

◆ operator=() [1/3]

const SStringA & SStringA::operator= ( char ch)

Overloaded assignment operator from a single character.

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

Definition at line 1017 of file sstringa.cpp.

◆ operator=() [2/3]

SStringA & SStringA::operator= ( const char * psz)

Overloaded assignment operator from a character array.

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

Definition at line 1023 of file sstringa.cpp.

◆ operator=() [3/3]

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

Overloaded assignment operator from another SStringA object.

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

Definition at line 1030 of file sstringa.cpp.

◆ operator[]()

char SStringA::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 1071 of file sstringa.cpp.

◆ Preallocate()

void SStringA::Preallocate ( int nLength)
protected

Preallocates memory for the string buffer.

Parameters
nLengthThe length to preallocate.

Definition at line 401 of file sstringa.cpp.

◆ ReallocBuffer()

bool SStringA::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 186 of file sstringa.cpp.

◆ Release()

void SStringA::Release ( )

Releases the string and its resources.

Definition at line 1191 of file sstringa.cpp.

◆ ReleaseBuffer()

void SStringA::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 469 of file sstringa.cpp.

◆ ReleaseData()

void SStringA::ReleaseData ( TStringData * pData)
staticprotected

Releases a data structure.

Parameters
pDataThe data structure to release.

Definition at line 139 of file sstringa.cpp.

◆ Remove()

int SStringA::Remove ( char chRemove)

Removes all occurrences of a character from the string.

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

Definition at line 595 of file sstringa.cpp.

◆ Replace()

int SStringA::Replace ( const char * pszOld,
const char * 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 619 of file sstringa.cpp.

◆ ReplaceChar()

int SStringA::ReplaceChar ( char chOld,
char 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 680 of file sstringa.cpp.

◆ ReverseFind()

int SStringA::ReverseFind ( char 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 586 of file sstringa.cpp.

◆ Right()

SStringA SStringA::Right ( int nCount) const

Extracts the rightmost part of the string.

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

Definition at line 938 of file sstringa.cpp.

◆ SafeStrlen()

int SStringA::SafeStrlen ( const char * 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 378 of file sstringa.cpp.

◆ SetAt()

void SStringA::SetAt ( int nIndex,
char ch )

Sets the character at a specified index.

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

Definition at line 1062 of file sstringa.cpp.

◆ SetLength()

void SStringA::SetLength ( int nLength)

Sets the length of the string.

Parameters
nLengthThe new length of the string.

Definition at line 408 of file sstringa.cpp.

◆ StartsWith()

bool SStringA::StartsWith ( const SStringA & 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 793 of file sstringa.cpp.

◆ ToBool()

BOOL SStringA::ToBool ( )

Converts the string to a boolean.

Returns
The boolean value.

Definition at line 1218 of file sstringa.cpp.

◆ ToDouble()

double SStringA::ToDouble ( )

Converts the string to a double.

Returns
The double value.

Definition at line 1214 of file sstringa.cpp.

◆ ToFloat()

float SStringA::ToFloat ( )

Converts the string to a float.

Returns
The float value.

Definition at line 1210 of file sstringa.cpp.

◆ ToInt()

int SStringA::ToInt ( )

Converts the string to an integer.

Returns
The integer value.

Definition at line 1206 of file sstringa.cpp.

◆ ToLong()

long SStringA::ToLong ( )

Converts the string to a long integer.

Returns
The long integer value.

Definition at line 1201 of file sstringa.cpp.

◆ ToLower()

void SStringA::ToLower ( )

Converts the string to lowercase.

Definition at line 897 of file sstringa.cpp.

◆ ToUint()

UINT SStringA::ToUint ( )

Converts the string to an unsigned integer.

Returns
The unsigned integer value.

Definition at line 1197 of file sstringa.cpp.

◆ ToUpper()

void SStringA::ToUpper ( )

Converts the string to uppercase.

Definition at line 905 of file sstringa.cpp.

◆ Trim()

void SStringA::Trim ( char chTarget = VK_SPACE)

Trims leading and trailing whitespace characters from the string.

Parameters
chTargetThe character to trim.

Definition at line 842 of file sstringa.cpp.

◆ TrimBlank()

void SStringA::TrimBlank ( )

Trims leading and trailing whitespace characters from the string.

Definition at line 806 of file sstringa.cpp.

◆ TrimLeft()

void SStringA::TrimLeft ( char chTarget = VK_SPACE)

Trims leading whitespace characters from the string.

Parameters
chTargetThe character to trim.

Definition at line 848 of file sstringa.cpp.

◆ TrimRight()

void SStringA::TrimRight ( char chTarget = VK_SPACE)

Trims trailing whitespace characters from the string.

Parameters
chTargetThe character to trim.

Definition at line 868 of file sstringa.cpp.

Friends And Related Symbol Documentation

◆ operator!= [1/3]

bool __stdcall operator!= ( const char * s1,
const SStringA & s2 )
friend

Overloaded inequality operator between a character array and an SStringA 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 sstringa.h.

◆ operator!= [2/3]

bool __stdcall operator!= ( const SStringA & s1,
const char * s2 )
friend

Overloaded inequality operator between an SStringA 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 sstringa.h.

◆ operator!= [3/3]

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

Overloaded inequality operator between two SStringA objects.

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

Definition at line 462 of file sstringa.h.

◆ operator+ [1/5]

SStringA __stdcall operator+ ( char ch,
const SStringA & string )
friend

Overloaded addition operator between a single character and an SStringA 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 sstringa.h.

◆ operator+ [2/5]

SStringA __stdcall operator+ ( const char * psz,
const SStringA & string )
friend

Overloaded addition operator between a character array and an SStringA 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 sstringa.h.

◆ operator+ [3/5]

SStringA __stdcall operator+ ( const SStringA & string,
const char * psz )
friend

Overloaded addition operator between an SStringA 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 sstringa.h.

◆ operator+ [4/5]

SStringA __stdcall operator+ ( const SStringA & string1,
char ch )
friend

Overloaded addition operator between an SStringA 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 sstringa.h.

◆ operator+ [5/5]

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

Overloaded addition operator between two SStringA 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 sstringa.h.

◆ operator< [1/3]

bool __stdcall operator< ( const char * s1,
const SStringA & s2 )
friend

Overloaded less-than operator between a character array and an SStringA 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 sstringa.h.

◆ operator< [2/3]

bool __stdcall operator< ( const SStringA & s1,
const char * s2 )
friend

Overloaded less-than operator between an SStringA 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 sstringa.h.

◆ operator< [3/3]

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

Overloaded less-than operator between two SStringA 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 sstringa.h.

◆ operator<= [1/3]

bool __stdcall operator<= ( const char * s1,
const SStringA & s2 )
friend

Overloaded less-than-or-equal-to operator between a character array and an SStringA 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 sstringa.h.

◆ operator<= [2/3]

bool __stdcall operator<= ( const SStringA & s1,
const char * s2 )
friend

Overloaded less-than-or-equal-to operator between an SStringA 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 sstringa.h.

◆ operator<= [3/3]

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

Overloaded less-than-or-equal-to operator between two SStringA 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 sstringa.h.

◆ operator== [1/3]

bool __stdcall operator== ( const char * s1,
const SStringA & s2 )
friend

Overloaded equality operator between a character array and an SStringA 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 sstringa.h.

◆ operator== [2/3]

bool __stdcall operator== ( const SStringA & s1,
const char * s2 )
friend

Overloaded equality operator between an SStringA 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 sstringa.h.

◆ operator== [3/3]

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

Overloaded equality operator between two SStringA objects.

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

Definition at line 435 of file sstringa.h.

◆ operator> [1/3]

bool __stdcall operator> ( const char * s1,
const SStringA & s2 )
friend

Overloaded greater-than operator between a character array and an SStringA 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 sstringa.h.

◆ operator> [2/3]

bool __stdcall operator> ( const SStringA & s1,
const char * s2 )
friend

Overloaded greater-than operator between an SStringA 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 sstringa.h.

◆ operator> [3/3]

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

Overloaded greater-than operator between two SStringA 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 sstringa.h.

◆ operator>= [1/3]

bool __stdcall operator>= ( const char * s1,
const SStringA & s2 )
friend

Overloaded greater-than-or-equal-to operator between a character array and an SStringA 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 sstringa.h.

◆ operator>= [2/3]

bool __stdcall operator>= ( const SStringA & s1,
const char * s2 )
friend

Overloaded greater-than-or-equal-to operator between an SStringA 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 sstringa.h.

◆ operator>= [3/3]

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

Overloaded greater-than-or-equal-to operator between two SStringA 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 sstringa.h.

Member Data Documentation

◆ m_pszData

char* SStringA::m_pszData
protected

Pointer to the ref counted string data.

Definition at line 763 of file sstringa.h.


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