Provides support for manipulating character values. More...
#include <SQLAPI.h>
Inherited by SABytes, and SALongOrLob.
Public Member Functions | |
size_t | GetLength () const |
Returns the data length (in characters). More... | |
bool | IsEmpty () const |
Tests whether a SAString object contains no characters. More... | |
void | Empty () |
Clears contents to empty. More... | |
operator const SAChar * () const | |
Directly accesses characters stored in a SAString object as a C-style string. More... | |
const SAString & | operator= (const SAString &sSrc) |
Ref-counted copy from another SAString. More... | |
const SAString & | operator= (SAChar ch) |
Sets string content to single character. More... | |
const SAString & | operator= (const char *lpsz) |
Copies string content from ANSI (multibyte) string (converts to SAChar) More... | |
const SAString & | operator= (const wchar_t *lpsz) |
Copies string content from UNICODE string (converts to SAChar) More... | |
const SAString & | operator= (const unsigned char *psz) |
Copies string content from unsigned chars. More... | |
const SAString & | operator+= (const SAString &string) |
Concatenates from another SAString. | |
const SAString & | operator+= (SAChar ch) |
Concatenates a single character. | |
const SAString & | operator+= (const SAChar *lpsz) |
Concatenates from a SAChar string. | |
int | Compare (const SAChar *lpsz) const |
Compares two strings (case sensitive). More... | |
int | CompareNoCase (const SAChar *lpsz) const |
Compares two strings (case insensitive). More... | |
int | Collate (const SAChar *lpsz) const |
Compares two strings (case sensitive, uses locale-specific information). More... | |
void | MakeUpper () |
Converts the object to an uppercase. | |
void | MakeLower () |
Converts the object to an lowercases. | |
SAString | Left (size_t nCount) const |
Extracts the left part of a string. More... | |
SAString | Right (size_t nCount) const |
Extracts the right part of a string. More... | |
SAChar | GetAt (size_t nPos) const |
Returns the character at the specified string position. | |
void | TrimRight () |
Removes whitespace starting from right edge. More... | |
void | TrimLeft () |
Removes whitespace starting from left side. More... | |
void | TrimRight (SAChar chTarget) |
Removes continuous occurrences of chTarget starting from right. More... | |
void | TrimRight (const SAChar *lpszTargets) |
Removes continuous occurrences of characters in passed string, starting from right. More... | |
void | TrimLeft (SAChar chTarget) |
Removes continuous occurrences of chTarget starting from left. More... | |
void | TrimLeft (const SAChar *lpszTargets) |
Removes continuous occurrences of characters in passed string, starting from left. More... | |
size_t | Replace (const SAChar *lpszOld, const SAChar *lpszNew) |
Replaces indicated characters with other characters. More... | |
size_t | Delete (size_t nIndex, size_t nCount=1) |
Deletes a character or characters from a string. More... | |
void | Format (const SAChar *lpszFormat,...) |
Printf-like formatting using passed string. More... | |
void | FormatV (const SAChar *, va_list argList) |
Printf-like formatting using variable arguments parameter. More... | |
SAChar * | GetBuffer (size_t nMinBufLength) |
Returns a pointer to the characters in the SAString. More... | |
void | ReleaseBuffer (size_t nNewLength=SIZE_MAX) |
Releases control of the buffer returned by GetBuffer. More... | |
SAChar * | LockBuffer () |
Disables reference counting and protects the string in the buffer. More... | |
void | UnlockBuffer () |
Enables reference counting and releases the string in the buffer. More... | |
size_t | GetBinaryLength () const |
Returns a count of the bytes in the binary data buffer. More... | |
operator const void * () const | |
Returns pointer to const binary data buffer. More... | |
void * | GetBinaryBuffer (size_t nMinBufLengthInBytes) |
Gets pointer to modifiable binary data buffer. More... | |
void | ReleaseBinaryBuffer (size_t nNewLengthInBytes) |
Releases control of the buffer returned by GetBinaryBuffer. More... | |
const wchar_t * | GetWideChars () const |
Returns pointer to const Unicode string, converts the data if needed. More... | |
size_t | GetWideCharsLength () const |
Returns the string length (in Unicode characters). More... | |
const char * | GetMultiByteChars () const |
Return pointer to const multibyte string, converts the data if needed. More... | |
size_t | GetMultiByteCharsLength () const |
Returns the string length (in multibyte characters). More... | |
const void * | GetUTF16Chars () const |
Returns pointer to const UTF16 string. | |
size_t | GetUTF16CharsLength () const |
Returns the string length (in UTF16 characters). | |
void | SetUTF16Chars (const void *szSrc, size_t nSrcLen=SIZE_MAX) |
Assigns the UTF16 data into SAString object. | |
SAString () | |
SAString (const SAString &stringSrc) | |
Copy constructor. | |
SAString (SAChar ch, size_t nRepeat=1) | |
Initializes SAString from a single character. | |
SAString (const char *lpsz) | |
Initializes SAString from an ANSI (multibyte) string. | |
SAString (const wchar_t *lpsz) | |
Initializes SAString from a UNICODE string (converts to SAChar) | |
SAString (const char *lpch, size_t nLength) | |
SA_UNICODE. | |
SAString (const wchar_t *lpch, size_t nLength) | |
Initializes SAString from subset of characters from a UNICODE string (converts to SAChar) | |
SAString (const unsigned char *psz) | |
Initializes SAString from unsigned characters (converts to SAChar) | |
SAString (const void *pBuffer, size_t nLengthInBytes) | |
Special constructor for binary data (no conversion to SAChar) | |
SAString | Mid (size_t nFirst) const |
Return all characters starting at zero-based nFirst. More... | |
SAString | Mid (size_t nFirst, size_t nCount) const |
Return nCount characters starting at zero-based nFirst. More... | |
size_t | Insert (size_t nIndex, SAChar ch) |
Insert character at zero-based index; concatenates if index is past end of string. More... | |
size_t | Insert (size_t nIndex, const SAChar *pstr) |
Insert substring at zero-based index; concatenates if index is past end of string. More... | |
size_t | Find (SAChar ch) const |
Find character starting at left, SIZE_MAX if not found. More... | |
size_t | Find (SAChar ch, size_t nStart) const |
Find character starting at zero-based index and going right. More... | |
size_t | Find (const SAChar *lpszSub) const |
Finds first instance of substring. More... | |
size_t | Find (const SAChar *lpszSub, size_t nStart) const |
Finds first instance of substring starting at zero-based index. More... | |
size_t | ReverseFind (SAChar ch) const |
Finds a character inside a larger string; starts from the end. More... | |
size_t | FindOneOf (const SAChar *lpszCharSet) const |
Finds the first matching character from a set. More... | |
Provides support for manipulating character values.
SAString is a subsidiary class. SAString object consists of a variable-length sequence of characters. The SAString class provides support for manipulating strings.
It is intended to replace and extend the functionality normally provided by the C run-time library string package. The SAString class supplies member functions and operators for simplified string handling. The class also provides constructors and operators for constructing, assigning, and comparing SAString objects and standard C++ string data types.
Concatenation and comparison operators, together with simplified memory management, make SAString objects easier to use than ordinary character arrays.
SAString::SAString | ( | ) |
size_t SAString::GetLength | ( | ) | const |
Returns the data length (in characters).
bool SAString::IsEmpty | ( | ) | const |
Tests whether a SAString object contains no characters.
void SAString::Empty | ( | ) |
Clears contents to empty.
Makes this SAString object an empty string and frees memory as appropriate.
SAString::operator const SAChar * | ( | ) | const |
Directly accesses characters stored in a SAString object as a C-style string.
const SAString & SAString::operator= | ( | const char * | lpsz | ) |
Copies string content from ANSI (multibyte) string (converts to SAChar)
const SAString & SAString::operator= | ( | const wchar_t * | lpsz | ) |
Copies string content from UNICODE string (converts to SAChar)
SA_UNICODE.
const SAString & SAString::operator= | ( | const unsigned char * | psz | ) |
int SAString::Compare | ( | const SAChar * | lpsz | ) | const |
Compares two strings (case sensitive).
lpsz | The other string used for comparison. |
int SAString::CompareNoCase | ( | const SAChar * | lpsz | ) | const |
Compares two strings (case insensitive).
lpsz | The other string used for comparison. |
int SAString::Collate | ( | const SAChar * | lpsz | ) | const |
Compares two strings (case sensitive, uses locale-specific information).
lpsz | The other string used for comparison. |
SAString SAString::Mid | ( | size_t | nFirst | ) | const |
Return all characters starting at zero-based nFirst.
nFirst | The zero-based index of the first character in this SAString object that is to be included in the extracted substring. |
SAString SAString::Mid | ( | size_t | nFirst, |
size_t | nCount | ||
) | const |
Return nCount characters starting at zero-based nFirst.
SAString SAString::Left | ( | size_t | nCount | ) | const |
Extracts the left part of a string.
Return first nCount characters in string.
nCount | The number of characters to extract from this SAString object. |
SAString SAString::Right | ( | size_t | nCount | ) | const |
Extracts the right part of a string.
Return nCount characters from end of string.
nCount | The number of characters to extract from this SAString object. |
void SAString::TrimRight | ( | ) |
Removes whitespace starting from right edge.
void SAString::TrimLeft | ( | ) |
Removes whitespace starting from left side.
void SAString::TrimRight | ( | SAChar | chTarget | ) |
Removes continuous occurrences of chTarget starting from right.
chTarget | The target characters to be trimmed. |
void SAString::TrimRight | ( | const SAChar * | lpszTargetList | ) |
Removes continuous occurrences of characters in passed string, starting from right.
lpszTargetList | A pointer to a string containing the target characters to be trimmed. |
void SAString::TrimLeft | ( | SAChar | chTarget | ) |
Removes continuous occurrences of chTarget starting from left.
chTarget | The target characters to be trimmed. |
void SAString::TrimLeft | ( | const SAChar * | lpszTargets | ) |
Removes continuous occurrences of characters in passed string, starting from left.
lpszTargets | A pointer to a string containing the target characters to be trimmed. |
Replaces indicated characters with other characters.
lpszOld | A pointer to a string containing the character to be replaced by lpszNew. |
lpszNew | A pointer to a string containing the character replacing lpszOld. |
size_t SAString::Insert | ( | size_t | nIndex, |
SAChar | ch | ||
) |
Insert character at zero-based index; concatenates if index is past end of string.
Inserts a single character or a substring at the given index within the string.
nIndex | The index of the character before which the insertion will take place. |
ch | The character to be inserted. |
size_t SAString::Insert | ( | size_t | nIndex, |
const SAChar * | pstr | ||
) |
Insert substring at zero-based index; concatenates if index is past end of string.
nIndex | The index of the character before which the insertion will take place. |
pstr | A pointer to the substring to be inserted. |
size_t SAString::Delete | ( | size_t | nIndex, |
size_t | nCount = 1 |
||
) |
Deletes a character or characters from a string.
nIndex | The index of the first character to delete. |
nCount | The number of characters to be removed. |
size_t SAString::Find | ( | SAChar | ch | ) | const |
Find character starting at left, SIZE_MAX if not found.
Finds a character or substring inside a larger string.
ch | A single character to search for. |
size_t SAString::Find | ( | SAChar | ch, |
size_t | nStart | ||
) | const |
Find character starting at zero-based index and going right.
ch | A single character to search for. |
nStart | The index of the character in the string to begin the search with, or 0 to start from the beginning. The character at nStart is excluded from the search if nStart is not equal to 0. |
size_t SAString::Find | ( | const SAChar * | lpszSub | ) | const |
Finds first instance of substring.
lpszSub | A substring to search for. |
size_t SAString::Find | ( | const SAChar * | lpszSub, |
size_t | nStart | ||
) | const |
Finds first instance of substring starting at zero-based index.
nStart | The index of the character in the string to begin the search with, or 0 to start from the beginning. The character at nStart is excluded from the search if nStart is not equal to 0. |
lpszSub | A substring to search for. |
size_t SAString::ReverseFind | ( | SAChar | ch | ) | const |
Finds a character inside a larger string; starts from the end.
ch | The character to search for. |
size_t SAString::FindOneOf | ( | const SAChar * | lpszCharSet | ) | const |
Finds the first matching character from a set.
lpszCharSet | String containing characters for matching. |
void SAString::Format | ( | const SAChar * | lpszFormat, |
... | |||
) |
Printf-like formatting using passed string.
Formats the string as sprintf does.
void SAString::FormatV | ( | const SAChar * | lpszFormat, |
va_list | argList | ||
) |
Printf-like formatting using variable arguments parameter.
Formats the string as vsprintf does.
SAChar * SAString::GetBuffer | ( | size_t | nMinBufLength | ) |
Returns a pointer to the characters in the SAString.
nMinBufLength | The minimum size of the character buffer in characters. This value does not include space for a null terminator. |
void SAString::ReleaseBuffer | ( | size_t | nNewLength = SIZE_MAX | ) |
Releases control of the buffer returned by GetBuffer.
nNewLength | The new length of the string in characters, not counting a null terminator. If the string is null-terminated, the -1 default value sets the SAString size to the current length of the string. |
SAChar * SAString::LockBuffer | ( | ) |
Disables reference counting and protects the string in the buffer.
By locking the string in the buffer, you ensure that the string’s exclusive hold on the buffer will remain intact.
After you have finished with LockBuffer, call UnlockBuffer to reset the reference count to 1.
void SAString::UnlockBuffer | ( | ) |
Enables reference counting and releases the string in the buffer.
size_t SAString::GetBinaryLength | ( | ) | const |
Returns a count of the bytes in the binary data buffer.
SAString::operator const void * | ( | ) | const |
Returns pointer to const binary data buffer.
void * SAString::GetBinaryBuffer | ( | size_t | nMinBufLengthInBytes | ) |
Gets pointer to modifiable binary data buffer.
nMinBufLengthInBytes | The minimum size of the binary data buffer in bytes. |
void SAString::ReleaseBinaryBuffer | ( | size_t | nNewLengthInBytes | ) |
Releases control of the buffer returned by GetBinaryBuffer.
nNewLengthInBytes | The new length of the binary data buffer represented by the SAString object in bytes. |
const wchar_t * SAString::GetWideChars | ( | ) | const |
Returns pointer to const Unicode string, converts the data if needed.
size_t SAString::GetWideCharsLength | ( | ) | const |
Returns the string length (in Unicode characters).
const char * SAString::GetMultiByteChars | ( | ) | const |
Return pointer to const multibyte string, converts the data if needed.
size_t SAString::GetMultiByteCharsLength | ( | ) | const |
Returns the string length (in multibyte characters).