ADTF  3.18.2
string_base< storageT >

String Class. More...

Public Types

typedef string_base< storageT > _myType
 definition my type
 
typedef storageT _StorageType
 definition storage type
 
typedef _StorageType::value_type value_type
 definition of value type
 
typedef _StorageType::iterator iterator
 short typedefinition for cString iterators
 
typedef _StorageType::const_iterator const_iterator
 short typedefinition for cString iterators
 
typedef _StorageType::reverse_iterator reverse_iterator
 short typedefinition for cString reverse iterators
 
typedef _StorageType::const_reverse_iterator const_reverse_iterator
 short typedefinition for cString reverse iterators
 

Public Member Functions

 string_base ()
 Constructor that initializes an empty cStringA object.
 
 string_base (const _myType &strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
string_baseoperator= (const _myType &strValue)
 The cString assignment (=) operator assigns a new value to the existing cString object. More...
 
 string_base (_myType &&strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
string_baseoperator= (_myType &&strValue)
 The cString assignment (=) operator assigns a new value to the existing cString object. More...
 
template<class T2 >
 string_base (const string_base< T2 > &strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
template<class T2 >
string_baseoperator= (const string_base< T2 > &strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
 string_base (const _StorageType &strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
string_baseoperator= (const _StorageType &strValue)
 The cString assignment (=) operator assigns a new value to the existing cString object. More...
 
 string_base (const tChar &strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
string_baseoperator= (const tChar &strValue)
 The cString assignment (=) operator assigns a new value to the existing cString object. More...
 
 string_base (const tChar *strValue)
 Constructor that initalizes an existing cString object with the spezified string value.
 
 string_base (const tChar *strValue, tSize szLength)
 Constructor that initalizes an existing cString object with the spezified string value. More...
 
string_baseoperator= (const tChar *strValue)
 The cString assignment (=) operator assigns a new value to the existing cString object. More...
 
virtual ~string_base ()
 Destructor.
 
iterator begin ()
 Iterator to beginning.
 
iterator end ()
 Iterator to end.
 
reverse_iterator rbegin ()
 Reverse iterator to beginning.
 
reverse_iterator rend ()
 Reverse iterator to end.
 
const_iterator cbegin () const
 Iterator to beginning.
 
const_iterator cend () const
 Iterator to end.
 
const_reverse_iterator crbegin () const
 Reverse iterator to beginning.
 
const_reverse_iterator crend () const
 Reverse iterator to end.
 
tVoid Clear ()
 Makes this cStringA object an empty string and frees memory as appropriate.
 
_myTypeSet (const _myType &strStringToSet, tSize nLength=InvalidPos)
 Assigns a new value to a cStringA object. More...
 
_myTypeSet (const tChar *pString, tSize nLength=InvalidPos)
 Assigns a new value to a cStringA object. More...
 
_myTypeSet (tChar c, tSize nCount)
 Assigns a new value to a cStringA object. More...
 
tSize GetLength () const
 This function returns the number of characters in a cStringA object. More...
 
tSize SetBuffer (tSize szSize)
 Sets or resizes the internal string buffer. More...
 
tSize GetBufferSize () const
 Get the size of the internal allocated string buffer. More...
 
tChar GetAt (tSize nIdx) const
 You can think of a cStringA object as an array of characters. More...
 
tVoid SetAt (tSize nIdx, tChar c)
 The SetAt member function sets a single character at a specified position. More...
 
const tCharoperator[] (tSize nIdx) const
 array access operator More...
 
tCharoperator[] (tSize nIdx)
 array access operator More...
 
tBool IsEmpty () const
 This function checks if the string object is empty. More...
 
tBool IsNotEmpty () const
 This function checks if the string object is not empty. More...
 
const tCharGetPtr () const
 This function returns the current string as an array of characters (c-style) More...
 
tCharGetBuffer ()
 This function returns the pointer to the data. More...
 
_myTypeAppend (const _myType &strString, tSize nLength=InvalidPos)
 This function appends a string to the end of the cStringA object. More...
 
_myTypeAppend (tChar c)
 This function appends one character to the end of the cStringA object. More...
 
_myTypeDelete (tSize nPos, tSize nLength=InvalidPos)
 This function deletes a substring of length nLength characters from the cStringA object, starting at position nPos (zero-based). More...
 
_myTypeInsert (const _myType &strToInsertString, tSize nPos, tSize nLength=InvalidPos)
 This function inserts a string into the cStringA object. More...
 
_myTypeInsert (const tChar *pToInsertString, tSize nPos, tSize nLength=InvalidPos)
 This function inserts a string into the cStringA object. More...
 
tInt Compare (const _myType &strString, tSize nPos=0, tSize nLength=InvalidPos) const
 This function compares a cStringA object with another string using the generic-text function _tcscmp. More...
 
tInt Compare (const tChar *strString, tSize nPos=0, tSize nLength=InvalidPos) const
 This function compares a cStringA object with another string using the generic-text function _tcscmp. More...
 
tInt CompareNoCase (const _myType &strString, tSize nPos=0, tSize nLength=InvalidPos) const
 This function compares a cStringA object with another string using the generic-text function _tcsicmp. More...
 
tBool IsEqual (const _myType &strCmp, tSize nPos=0, tSize nLength=InvalidPos) const
 This function checks if the two strings are equal (case sensitive) More...
 
tBool IsEqualNoCase (const _myType &strCmp, tSize nPos=0, tSize nLength=InvalidPos) const
 This function checks if the two strings are equal (case insensitive) More...
 
tBool IsNotEqual (const _myType &strCmp, tSize nPos=0, tSize nLength=InvalidPos) const
 This function checks if the two strings are not equal (case sensitive) More...
 
tBool IsNotEqualNoCase (const _myType &strCmp, tSize nPos=0, tSize nLength=InvalidPos) const
 This function checks if the two strings are not equal (case insensitive) More...
 
tSize Find (const _myType &strStringToFind, tSize nStart=0, const tBool bNoCase=tFalse) const
 This function searches the cStringA object for the first match of a substring. More...
 
tSize Find (tChar cToFind, tSize nStart=0) const
 This function searches the cStringA object for the first match of the specified character. More...
 
tSize RFind (tChar cChar, tSize nStart=0) const
 This function searches the cStringA object for the last match of the specified character. More...
 
tSize FindToken (const _myType &strTokenList, tSize nStart=0) const
 This function searches a string for the first character that matches any character contained in a token list. More...
 
tSize FindNotToken (const _myType &strTokenList, tSize nStart=0) const
 This function searches a string for the first character that matches none of the characters contained in a token list. More...
 
tSize CountString (const _myType &strFind, tSize nStart=0) const
 This counts the occurrences of a given substring in a string. More...
 
tSize Replace (const _myType &strOld, const _myType &strNew, tBool bReplaceAll=tTrue)
 This function replaces one substring by another. More...
 
tSize Replace (tChar cOld, tChar cNew, tBool bReplaceAll=tTrue)
 This function replaces one character by another. More...
 
tSize Filter (tChar cChar)
 This function removes all occurrences of a given character from a string. More...
 
tSize Filter (const _myType &strCharList)
 This function removes all occurrences of each character given in a token list. More...
 
tBool StartsWith (const _myType &strStartsWith, const tBool bNoCase=tFalse) const
 This function checks if the string starts with a given prefix. More...
 
tSize RSplitByToken (const tChar cToken, _myType &strFirst, _myType &strSecond) const
 
tSize SplitByToken (const tChar cToken, _myType &strFirst, _myType &strSecond) const
 
tBool EndsWith (const _myType &strEndsWith, const tBool bNoCase=tFalse) const
 This function checks if the string ends with a given postfix. More...
 
 operator const tChar * () const
 This useful casting operator provides an efficient method to access the null- terminated C string contained in a cStringA object. More...
 
const _myTypeoperator+= (const _myType &strString)
 The += concatenation operator joins characters to the end of this string. More...
 
tBool operator== (const tChar *pString) const
 Checks if a string equals the cStringA object. More...
 
tBool operator!= (const tChar *pString) const
 Checks if a string does not equal the cStringA object. More...
 
tBool operator< (const tChar *pString) const
 Checks if a string is lexicographically greater than the cStringA object. More...
 
tBool operator> (const tChar *pString) const
 Checks if a string is lexicographically smaller than the cStringA object. More...
 
tBool operator<= (const tChar *pString) const
 Checks if a string is lexicographically greater than or equal to the cStringA object. More...
 
tBool operator>= (const tChar *pString) const
 Checks if a string is lexicographically smaller than or equal to the cStringA object. More...
 
tBool operator== (const _myType &strString) const
 Checks if a string equals the cStringA object. More...
 
tBool operator!= (const _myType &strString) const
 Checks if a string not equals the cStringA object. More...
 
tBool operator< (const _myType &strString) const
 Checks if a string is lexicographically greater than the cStringA object. More...
 
tBool operator> (const _myType &strString) const
 Checks if a string is lexicographically smaller than the cStringA object. More...
 
tBool operator<= (const _myType &strString) const
 Checks if a string is lexicographically greater than or equal to the cStringA object. More...
 
tBool operator>= (const _myType &strString) const
 Checks if a string is lexicographically smaller than or equal to the cStringA object. More...
 
_myType SubString (tSize nPos, tSize nLength=InvalidPos) const
 This function extracts a substring of length nLength characters from the cStringA object, starting at position nPos (zero-based). More...
 
_myType Mid (tSize nPos, tSize nLength=InvalidPos) const
 This function extracts a substring of length nLength characters from the cStringA object, starting at position nPos (zero-based). More...
 
_myType Left (tSize nLength) const
 Extracts the first (that is, leftmost) nLength characters from the cStringA object and returns a copy of the extracted substring. More...
 
_myType Right (tSize nLength) const
 Extracts the last (that is, rightmost) nLength characters from the cStringA object and returns a copy of the extracted substring. More...
 
tVoid Split (string_list_base< _myType > &lstSplittedResult, tChar cToken) const
 This function splits up a single cStringA object into several parts using a token character. More...
 
tVoid Split (string_list_base< _myType > &lstSplittedResult, const _myType &strToken) const
 This function splits up a single cStringA object into several parts using a token string. More...
 
tVoid SplitToken (string_list_base< _myType > &lstList, const _myType &strTokenList) const
 Split string using a token list. More...
 
tVoid Trim ()
 This function removes leading and trailing whitespace characters from a cStringA object. More...
 
tVoid LeftTrim (tBool bNumTrim=tFalse)
 This function removes leading whitespace characters or leading zero characters from a cStringA object. More...
 
tVoid RightTrim ()
 This function removes trailing whitespace characters from a cStringA object.
 
tVoid NumTrim ()
 This function removes whitespace and redundant zero characters from a cStringA object. More...
 
tVoid DropQuotes ()
 This function removes quotes from a cStringA object. More...
 
tVoid ToLower ()
 This function converts a cStringA object to a lowercase string. More...
 
tVoid ToUpper ()
 This function converts a cStringA object to an uppercase string. More...
 
_myTypeEscape ()
 Escape control characters. More...
 
_myTypeUnescape ()
 Escape control characters. More...
 
tBool IsInteger () const
 Check if string content represents an integer value. More...
 
tBool IsFloat () const
 Check if string content represents a floating point value. More...
 
tBool IsNumeric () const
 Check if string content represents a numeric value. More...
 
tInt32 AsInt32 () const
 This function converts the string to an integer value. More...
 
tVoid ToType (tInt32 &i32Value) const
 This function converts the string to an integer value. More...
 
tUInt32 AsUInt32 () const
 This function converts the string to an integer value. More...
 
tVoid ToType (tUInt32 &ui32Value) const
 This function converts the string to an integer value. More...
 
tInt64 AsInt64 () const
 This function converts the string to an integer value. More...
 
tVoid ToType (tInt64 &i64Value) const
 This function converts the string to an integer value. More...
 
tUInt64 AsUInt64 () const
 This function converts the string to an integer value. More...
 
tVoid ToType (tUInt64 &ui64Value) const
 This function converts the string to an integer value. More...
 
tFloat64 AsFloat64 () const
 This function converts the string to a floating-point value. More...
 
tVoid ToType (tFloat64 &f64Value) const
 This function converts the string to a floating-point value. More...
 
tFloat32 AsFloat32 () const
 This function converts the string to a floating-point value. More...
 
tVoid ToType (tFloat32 &f32Value) const
 This function converts the string to a floating-point value. More...
 
tBool AsBool () const
 This function converts the string to a boolean value. More...
 
tVoid ToType (tBool &bValue) const
 This function converts the string to a boolean value. More...
 
tInt64 HexToInt64 () const
 This function converts a hexadecimal string representation to an integer value. More...
 
tSize GetMaxBufferSize () const
 Return maximum size of string buffer. More...
 
tVoid HexToType (tInt64 &i64Value) const
 This function converts a hexadecimal string representation to an integer value. More...
 

Static Public Member Functions

static _myType Repeat (tChar c, tSize nCount)
 Creates a string from a repeated character. More...
 
static _myType FromType (tInt32 i32Value, const _myType &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static _myType FromType (tUInt32 ui32Value, const _myType &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static _myType FromType (tInt64 i64Value, const _myType &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static _myType FromType (tUInt64 ui64Value, const _myType &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static _myType FromType (tFloat64 f64Value, const _myType &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static _myType FromType (tFloat32 f32Value, const _myType &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static _myType FromType (tBool bValue, const _myType &strFormat=Empty)
 This function creates a new cString object from a boolean value. More...
 
static _myType Format (const value_type *strFormat,...)
 Write formatted data to a string. More...
 
template<typename T >
static _myType ToStringFromType (T oValue, const _myType &strFormat)
 This function creates a new cString object from a numeric value. More...
 
static _myTypeCopy (_myType &strDestination, const _myType &strSource, tSize szLength=InvalidPos)
 Copies the value of one StringObject to another Stringobject. More...
 

Static Public Attributes

static const _myType Empty
 Internally used empty string.
 
static const tSize InvalidPos = g_npos
 used to identicate out of range, invalidpos or default length
 

Private Attributes

_StorageType m_oStorageBuffer
 storage buffer
 

Detailed Description

template<class storageT>
class A_UTILS_NS::string_base< storageT >

String Class.

Mind that this does not support any multi-byte encodings (UTF-8) but ANSI charsets only.

Definition at line 30 of file string.h.

Constructor & Destructor Documentation

◆ string_base()

string_base ( const tChar strValue,
tSize  szLength 
)
inline

Constructor that initalizes an existing cString object with the spezified string value.

Parameters
strValue[in] Source string.
szLength[in] Number of characters to be taken from the source string.

Definition at line 155 of file string.h.

References string_base< storageT >::Set().

Member Function Documentation

◆ Append() [1/2]

_myType& Append ( const _myType strString,
tSize  nLength = InvalidPos 
)
inline

This function appends a string to the end of the cStringA object.

Note
Please note that the string may only contain non-binary data!
Parameters
strString[in] cStringA object to be appended.
nLength[in] Number of characters that will be taken from strString for appending
Returns
The function returns a reference to itself containing the new string contents.

Definition at line 497 of file string.h.

References string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Filter(), string_base< storageT >::Insert(), A_UTILS_NS::operator+(), string_base< storageT >::operator+=(), and string_base< storageT >::Replace().

◆ Append() [2/2]

_myType& Append ( tChar  c)
inline

This function appends one character to the end of the cStringA object.

Note
Please note that appending a 0-Byte character ('\0') will be ignored.
Parameters
c[in] Character to be appended.
Returns
The function returns a reference to itself containing the new string contents.

Definition at line 537 of file string.h.

References string_base< storageT >::GetLength(), and string_base< storageT >::m_oStorageBuffer.

◆ AsBool()

tBool AsBool ( ) const
inline

This function converts the string to a boolean value.

Only the following strings will be interpreted as true (not case sensitive): "true","on","1", all other strings will be interpreted as false. If a string is concatenate by a true-literal (and vice versa) it is interpreted as false.

Returns
Converted boolean value

Definition at line 2305 of file string.h.

References string_base< storageT >::ToType().

◆ AsFloat32()

tFloat32 AsFloat32 ( ) const
inline

This function converts the string to a floating-point value.

The string has to be in the following format to be interpreted as a float: [whitespace][sign][digits][(.|,)digits][{d|D|e|E}[sign]digits]. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". Both '.' and ',' are interpreted as decimal point.

Returns
Converted floating-point value, 0.0 if value can not be converted

Definition at line 2259 of file string.h.

References string_base< storageT >::ToType().

◆ AsFloat64()

tFloat64 AsFloat64 ( ) const
inline

This function converts the string to a floating-point value.

The string has to be in the following format to be interpreted as a float: [whitespace][sign][digits][(.|,)digits][{d|D|e|E}[sign]digits]. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". Both '.' and ',' are interpreted as decimal point.

Returns
Converted floating-point value, 0.0 if value can not be converted

Definition at line 2212 of file string.h.

References string_base< storageT >::ToType().

◆ AsInt32()

tInt32 AsInt32 ( ) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt().
Returns
Converted integer value

Definition at line 2020 of file string.h.

References string_base< storageT >::ToType().

◆ AsInt64()

tInt64 AsInt64 ( ) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt(). If there is a negative integer, the 0 will be returned. A number with the prefix "+" will be correctly interpreted.
Returns
Converted integer value

Definition at line 2115 of file string.h.

References string_base< storageT >::ToType().

Referenced by adtf::remote::ant::parse_logging_rpc_buffer().

◆ AsUInt32()

tUInt32 AsUInt32 ( ) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt(). If there is a negative integer, the 0 will be returned. A number with the prefix "+" will be correctly interpreted
Returns
Converted integer value or 0 (error case) i.e. negative numbers

Definition at line 2066 of file string.h.

References string_base< storageT >::ToType().

Referenced by adtf::remote::ant::parse_logging_rpc_buffer().

◆ AsUInt64()

tUInt64 AsUInt64 ( ) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt().
Returns
Converted integer value or 0 (error case) i.e. negative numbers

Definition at line 2164 of file string.h.

References string_base< storageT >::ToType().

◆ Compare() [1/2]

tInt Compare ( const _myType strString,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function compares a cStringA object with another string using the generic-text function _tcscmp.

The generic-text function _tcscmp, which is defined in tChar.H, maps to either strcmp, wcscmp, or _mbscmp depending on the character set that is defined at compile time. Each of these functions performs a case-sensitive comparison of the strings, and is not affected by locale.

Parameters
[in]strStringThe other string used for comparison.
[in]nPosbeginning position to compare
[in]nLengthamount of characters to be compared. -1 means until end
Returns
Zero if the strings are identical, < 0 if the cStringA object is less than the string parameter strString, or > 0 if the cStringA object is greater than the string given in parameter strString.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 689 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

Referenced by string_base< storageT >::IsEqual(), string_base< storageT >::IsNotEqual(), string_base< storageT >::operator!=(), xml_string_compare_func::operator()(), string_base_compare_func< sT, sT2 >::operator()(), string_base< storageT >::operator<(), A_UTILS_NS::operator<(), string_base< storageT >::operator<=(), A_UTILS_NS::operator<=(), string_base< storageT >::operator==(), string_base< storageT >::operator>(), A_UTILS_NS::operator>(), string_base< storageT >::operator>=(), A_UTILS_NS::operator>=(), and string_base< storageT >::StartsWith().

◆ Compare() [2/2]

tInt Compare ( const tChar strString,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function compares a cStringA object with another string using the generic-text function _tcscmp.

Parameters
[in]strStringThe other string used for comparison.
[in]nPosbeginning position to compare
[in]nLengthamount of characters to be compared. -1 means until end
Returns
Zero if the strings are identical, < 0 if the cStringA object is less than the string parameter strString, or > 0 if the cStringA object is greater than the string given in parameter strString.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 710 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ CompareNoCase()

tInt CompareNoCase ( const _myType strString,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function compares a cStringA object with another string using the generic-text function _tcsicmp.

The generic-text function _tcsicmp, which is defined in tChar.H, maps to either _stricmp, _wcsicmp, _mbsicmp depending on the character set that is defined at compile time. Each of these functions performs a case-insensitive comparison of the strings, and is not affected by locale..

Parameters
strString[in] The other string used for comparison.
nPos[in] Compare from position nPos.
nLength[in] Compare only nLength characters.
Returns
Zero if the strings are identical (ignoring case), <0 if the cStringA object is less than parameter strString (ignoring case), or >0 if the cStringA object is greater the string given in parameter strString (ignoring case).
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 738 of file string.h.

References cStringUtil::CompareNoCase(), and string_base< storageT >::GetPtr().

Referenced by string_base< storageT >::IsNotEqualNoCase(), string_base_no_case_compare_func< sT, sT2 >::operator()(), and string_base< storageT >::StartsWith().

◆ Copy()

static _myType& Copy ( _myType strDestination,
const _myType strSource,
tSize  szLength = InvalidPos 
)
inlinestatic

Copies the value of one StringObject to another Stringobject.

Parameters
[out]strDestinationReference to the string that should store the copied value.
[in]strSourceReference to the source string from which the copy will be made.
[in]szLengthNumber of characters to be taken from the source string. As default, the complete string is copied.
Returns
Reference to the copied string.

Definition at line 2454 of file string.h.

References string_base< storageT >::Set().

◆ CountString()

tSize CountString ( const _myType strFind,
tSize  nStart = 0 
) const
inline

This counts the occurrences of a given substring in a string.

Parameters
strFind[in] Substring to be searched for.
nStart[in] Start position that the search begins with.
Returns
Number of occurrences of the given substring.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 962 of file string.h.

References string_base< storageT >::Find(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, and string_base< storageT >::IsEmpty().

◆ Delete()

_myType& Delete ( tSize  nPos,
tSize  nLength = InvalidPos 
)
inline

This function deletes a substring of length nLength characters from the cStringA object, starting at position nPos (zero-based).

The function returns a copy of the resulting string.

Parameters
nPos[in] The zero-based index of the first character in the cStringA object that is to be deleted.
nLength[in] The number of characters to delete from this cStringA object. If this parameter is not supplied, then the remainder of the string is deleted.
Returns
A copy of the resulting string.

Definition at line 578 of file string.h.

References string_base< storageT >::Clear(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::DropQuotes(), string_base< storageT >::LeftTrim(), string_base< storageT >::NumTrim(), and string_base< storageT >::RightTrim().

◆ DropQuotes()

tVoid DropQuotes ( )
inline

This function removes quotes from a cStringA object.

Quotes are '"' and '\''

Returns
tVoid

Definition at line 1719 of file string.h.

References string_base< storageT >::begin(), string_base< storageT >::Delete(), string_base< storageT >::GetLength(), string_base< storageT >::IsEmpty(), and string_base< storageT >::rbegin().

◆ EndsWith()

tBool EndsWith ( const _myType strEndsWith,
const tBool  bNoCase = tFalse 
) const
inline

This function checks if the string ends with a given postfix.

Parameters
strEndsWith[in] The postfix to check for.
bNoCase[in] Whether or not to check case insensitive or not.
Returns
tTrue if it ends with the postfix, otherwise tFalse.

Definition at line 1176 of file string.h.

References string_base< storageT >::GetLength(), string_base< storageT >::IsEqual(), string_base< storageT >::IsEqualNoCase(), string_base< storageT >::Right(), and tFalse.

Referenced by string_base< storageT >::Split().

◆ Escape()

◆ Filter() [1/2]

tSize Filter ( const _myType strCharList)
inline

This function removes all occurrences of each character given in a token list.

Parameters
strCharList[in] List of characters to be removed from the string.
Returns
Number of characters that have been removed from the string.

Definition at line 1097 of file string.h.

References string_base< storageT >::Append(), string_base< storageT >::Find(), string_base< storageT >::GetAt(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), string_base< storageT >::m_oStorageBuffer, and string_base< storageT >::SetBuffer().

◆ Filter() [2/2]

tSize Filter ( tChar  cChar)
inline

This function removes all occurrences of a given character from a string.

Parameters
cChar[in] Character to be removed from the string.
Returns
Number of characters that have been removed from the string.

Definition at line 1081 of file string.h.

◆ Find() [1/2]

tSize Find ( const _myType strStringToFind,
tSize  nStart = 0,
const tBool  bNoCase = tFalse 
) const
inline

This function searches the cStringA object for the first match of a substring.

Parameters
strStringToFind[in] A substring to search for.
nStart[in] The index of the character in the string to begin the search with, or 0 to start from the beginning.
bNoCase[in] Compare case sensitive if flag is tFalse
Returns
The zero-based index of the first character in this cStringA object that matches the requested substring; -1 if the substring is not found.

Definition at line 831 of file string.h.

References string_base< storageT >::Find(), string_base< storageT >::m_oStorageBuffer, and string_base< storageT >::ToLower().

Referenced by string_base< storageT >::CountString(), string_base< storageT >::Filter(), string_base< storageT >::Find(), string_base< storageT >::Replace(), and string_base< storageT >::Split().

◆ Find() [2/2]

tSize Find ( tChar  cToFind,
tSize  nStart = 0 
) const
inline

This function searches the cStringA object for the first match of the specified character.

Parameters
cToFind[in] A single character to search for.
nStart[in] The index of the character in the string to begin the search with, or 0 to start from the beginning.
Returns
The zero-based index of the first character in this cStringA object that matches the requested characters; -1 if the character is not found.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 863 of file string.h.

References string_base< storageT >::Find(), and tFalse.

◆ FindNotToken()

tSize FindNotToken ( const _myType strTokenList,
tSize  nStart = 0 
) const
inline

This function searches a string for the first character that matches none of the characters contained in a token list.

Parameters
strTokenList[in] String containing characters for matching.
nStart[in] The index of the character in the string to begin the search with, or 0 to start from the beginning.
Returns
The zero-based index of the first character in this string that is not also in the token list; -1 if there is no match.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 937 of file string.h.

References string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), and string_base< storageT >::m_oStorageBuffer.

◆ FindToken()

tSize FindToken ( const _myType strTokenList,
tSize  nStart = 0 
) const
inline

This function searches a string for the first character that matches any character contained in a token list.

Parameters
strTokenList[in] String containing characters for matching.
nStart[in] The index of the character in the string to begin the search with, or 0 to start from the beginning.
Returns
The zero-based index of the first character in this string that is also in the token list; -1 if there is no match.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 908 of file string.h.

References string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::NumTrim(), and string_base< storageT >::SplitToken().

◆ Format()

static _myType Format ( const value_type strFormat,
  ... 
)
inlinestatic

Write formatted data to a string.

The Format method formats and stores a series of characters and values in a new cString buffer object. Each argument (if any) is converted and output according to the corresponding format specification in format. The format consists of ordinary characters and has the same form and function as the format argument for printf. If copying occurs between strings that overlap, the behavior is undefined.
For 64-Bit-Integer conversion use lld (Win32, Linux) or I64d (only Win32). lld maps to a long long integer whereas I64d maps to an integer with 64-bit size. The first one may not be typesafe but is portable between Windows and Linux.

Parameters
[in]strFormatFormat control string.
[in]argsVariable argument list.
Returns
New cString object containing the formatted data.

Definition at line 2399 of file string.h.

References string_base< storageT >::GetBuffer(), string_base< storageT >::GetBufferSize(), and string_base< storageT >::SetBuffer().

◆ FromType() [1/7]

static _myType FromType ( tBool  bValue,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a boolean value.

The numeric data is converted to an unformatted string.

Parameters
[in]bValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2336 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ FromType() [2/7]

static _myType FromType ( tFloat32  f32Value,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a numeric value.

The numeric data is converted to an unformatted string.

Parameters
[in]f32ValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2290 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ FromType() [3/7]

static _myType FromType ( tFloat64  f64Value,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a numeric value.

The numeric data is converted to an unformatted string.

Parameters
[in]f64ValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2243 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ FromType() [4/7]

static _myType FromType ( tInt32  i32Value,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a numeric value.

Parameters
[in]i32ValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2050 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ FromType() [5/7]

static _myType FromType ( tInt64  i64Value,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a numeric value.

The numeric data is converted to an unformatted string.

Parameters
[in]i64ValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2148 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ FromType() [6/7]

static _myType FromType ( tUInt32  ui32Value,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a numeric value.

Parameters
[in]ui32ValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2097 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ FromType() [7/7]

static _myType FromType ( tUInt64  ui64Value,
const _myType strFormat = Empty 
)
inlinestatic

This function creates a new cString object from a numeric value.

The numeric data is converted to an unformatted string.

Parameters
[in]ui64ValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2196 of file string.h.

References string_base< storageT >::ToStringFromType().

◆ GetAt()

tChar GetAt ( tSize  nIdx) const
inline

You can think of a cStringA object as an array of characters.

The GetAt member function returns a single character specified by an index number.

Parameters
nIdx[in] Zero-based index of the character in the cStringA object. The nIndex parameter must be greater than or equal to 0 and less than the value returned by GetLength.
Returns
A tChar containing the character at the specified position in the string.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 377 of file string.h.

References string_base< storageT >::GetLength(), and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Filter(), and string_base< storageT >::NumTrim().

◆ GetBuffer()

tChar* GetBuffer ( )
inline

This function returns the pointer to the data.

Returns
tChar* to the beginning of the array
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 480 of file string.h.

References string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Format(), and string_base< storageT >::ToStringFromType().

◆ GetBufferSize()

tSize GetBufferSize ( ) const
inline

Get the size of the internal allocated string buffer.

The returned size also includes the null-terminating byte ('\0').

Returns
the internal size of the string buffer (including the null-terminating byte ('\0')).

Definition at line 356 of file string.h.

References string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Escape(), string_base< storageT >::Format(), string_base< storageT >::SetBuffer(), and string_base< storageT >::ToStringFromType().

◆ GetLength()

◆ GetMaxBufferSize()

tSize GetMaxBufferSize ( ) const
inline

Return maximum size of string buffer.

Returns
tSize buffer size

Definition at line 2360 of file string.h.

References string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::ToStringFromType().

◆ GetPtr()

◆ HexToInt64()

tInt64 HexToInt64 ( ) const
inline

This function converts a hexadecimal string representation to an integer value.

A valid hex number has the following representation [+-]? 0? x? {[0-9a-fA-F]*

Returns
Converted integer value

Definition at line 2348 of file string.h.

References string_base< storageT >::HexToType().

◆ HexToType()

tVoid HexToType ( tInt64 i64Value) const
inline

This function converts a hexadecimal string representation to an integer value.

A valid hex number has the following representation [+-]? 0? x? {[0-9a-fA-F]*

Parameters
[out]i64ValueReference to the integer variable that should store the converted value.
Returns
tVoid

Definition at line 2375 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::HexToType().

Referenced by string_base< storageT >::HexToInt64().

◆ Insert() [1/2]

_myType& Insert ( const _myType strToInsertString,
tSize  nPos,
tSize  nLength = InvalidPos 
)
inline

This function inserts a string into the cStringA object.

If the nPos is greater than the length of the string or less than 0, strString will NOT be appended. A nLength of <= -1 inserts the complete string.

Parameters
strToInsertString[in] The string to insert.
nPos[in] The zero-based index of the position where to insert the string. If nPos is greater than the length of the String, the strString will not be appended!
nLength[in] The amount of characters of the string that should be inserted.
Returns
A copy of the resulting string.

Definition at line 634 of file string.h.

References string_base< storageT >::Append(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Insert().

◆ Insert() [2/2]

_myType& Insert ( const tChar pToInsertString,
tSize  nPos,
tSize  nLength = InvalidPos 
)
inline

This function inserts a string into the cStringA object.

If the nPos is greater than the length of the string or less than 0, pString will NOT be appended. A nLength of <= -1 inserts the complete string.

Parameters
pToInsertString[in] Pointer to the string to insert.
nPos[in] The zero-based index of the position where to insert the string. If nPos is greater than the length of the String, the strString will not be appended !
nLength[in] The amount of characters of the string that should be inserted.
Returns
A copy of the resulting string.

Definition at line 660 of file string.h.

References string_base< storageT >::Insert().

◆ IsEmpty()

◆ IsEqual()

tBool IsEqual ( const _myType strCmp,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function checks if the two strings are equal (case sensitive)

Parameters
strCmp[in] The other string used for comparison.
nPos[in] The start index of the strCmp/str1 to compare from.
nLength[in] The amount of characters that should be compared.
Returns
tTrue if the two strings are equal, tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 755 of file string.h.

References string_base< storageT >::Compare(), tFalse, and tTrue.

Referenced by string_base< storageT >::EndsWith(), cDDLCompareFunctor< T >::operator()(), and A_UTILS_NS::operator==().

◆ IsEqualNoCase()

tBool IsEqualNoCase ( const _myType strCmp,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function checks if the two strings are equal (case insensitive)

Parameters
strCmp[in] The other string used for comparison.
nPos[in] The start index of the strCmp/str1 to compare from .
nLength[in] The amount of characters that should be compared.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 773 of file string.h.

References cStringUtil::CompareNoCase(), string_base< storageT >::GetPtr(), tFalse, and tTrue.

Referenced by string_base< storageT >::EndsWith().

◆ IsFloat()

tBool IsFloat ( ) const
inline

Check if string content represents a floating point value.

Allowed float format [whitespace] [sign] [digits] [.digits] [ {d | D | e | E }[sign]digits] sign is either plus (+) or minus (-) digits (0123456789) The decimal digits may be followed by an exponent, which consists of an introductory letter (d, D, e, or E) and an optionally signed decimal integer.

Returns
tBool tTrue if the value represents a floating point number

Definition at line 1974 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::IsFloat().

Referenced by string_base< storageT >::IsNumeric().

◆ IsInteger()

tBool IsInteger ( ) const
inline

Check if string content represents an integer value.

A hex number will not be identified as an integer value.

  • and - may precede the number. White spaces are not allowed.
Returns
tBool, tTrue if the value is an integer number
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1957 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::IsInteger().

Referenced by string_base< storageT >::IsNumeric().

◆ IsNotEmpty()

tBool IsNotEmpty ( ) const
inline

This function checks if the string object is not empty.

Returns
tBool value that is true, if the string object is not empty.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 454 of file string.h.

References string_base< storageT >::IsEmpty().

Referenced by string_base< storageT >::SplitToken().

◆ IsNotEqual()

tBool IsNotEqual ( const _myType strCmp,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function checks if the two strings are not equal (case sensitive)

Parameters
strCmp[in] The other string used for comparison.
nPos[in] The start index to compare from.
nLength[in] The amount of characters that should be compared.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 790 of file string.h.

References string_base< storageT >::Compare(), tFalse, and tTrue.

Referenced by A_UTILS_NS::operator!=().

◆ IsNotEqualNoCase()

tBool IsNotEqualNoCase ( const _myType strCmp,
tSize  nPos = 0,
tSize  nLength = InvalidPos 
) const
inline

This function checks if the two strings are not equal (case insensitive)

Parameters
strCmp[in] The other string used for comparison.
nPos[in] The start index to compare from.
nLength[in] The amount of characters that should be compared.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 808 of file string.h.

References string_base< storageT >::CompareNoCase(), tFalse, and tTrue.

◆ IsNumeric()

tBool IsNumeric ( ) const
inline

Check if string content represents a numeric value.

See also

See also
IsInteger().
IsFloat().
Returns
tBool tTrue if the value represents an integer or a floating point number

Definition at line 1988 of file string.h.

References string_base< storageT >::IsFloat(), and string_base< storageT >::IsInteger().

◆ Left()

_myType Left ( tSize  nLength) const
inline

Extracts the first (that is, leftmost) nLength characters from the cStringA object and returns a copy of the extracted substring.

If nLength exceeds the string length, then the entire string is extracted. If the nLength is less than zero, an empty string will bee returned. Left is similar to the Basic LEFT$ function (except that indexes are zero-based).

Parameters
nLength[in] The number of characters to extract from this cStringA object.
Returns
A cStringA object that contains a copy of the specified range of characters. Note that the returned cStringA object may be empty.

Definition at line 1448 of file string.h.

References string_base< storageT >::SubString().

◆ LeftTrim()

tVoid LeftTrim ( tBool  bNumTrim = tFalse)
inline

This function removes leading whitespace characters or leading zero characters from a cStringA object.

It does not remove a '0' directly left to a comma or decimal point. " abc" -> "abc", "000045" -> "45", "000.45" -> "0.45"

Parameters
bNumTrim[in] Whether or not to trim leading '0'
Returns
tVoid

Definition at line 1622 of file string.h.

References string_base< storageT >::begin(), string_base< storageT >::Delete(), string_base< storageT >::end(), cStringUtil::IsOneOf(), cStringUtil::IsWhiteChar(), tFalse, and tTrue.

Referenced by string_base< storageT >::NumTrim(), and string_base< storageT >::Trim().

◆ Mid()

_myType Mid ( tSize  nPos,
tSize  nLength = InvalidPos 
) const
inline

This function extracts a substring of length nLength characters from the cStringA object, starting at position nPos (zero-based).

The function returns a copy of the extracted substring. Mid is similar to the Basic MID$ function (except that indexes are zero-based).

Parameters
nPos[in] The zero-based index of the first character in the cStringA object that is to be included in the extracted substring.
nLength[in] The number of characters to extract from this cStringA object. If this parameter is not supplied, then the remainder of the string is extracted.
Returns
A cStringA object that contains a copy of the specified range of characters. Note that the returned cStringA object may be empty.

Definition at line 1415 of file string.h.

References string_base< storageT >::Empty, string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), and string_base< storageT >::SubString().

Referenced by string_base< storageT >::Replace(), string_base< storageT >::Split(), and string_base< storageT >::SplitToken().

◆ NumTrim()

tVoid NumTrim ( )
inline

This function removes whitespace and redundant zero characters from a cStringA object.

The object will be trimmed on the right and on the left side.

Returns
tVoid

Definition at line 1670 of file string.h.

References string_base< storageT >::Delete(), string_base< storageT >::FindToken(), string_base< storageT >::GetAt(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), cStringUtil::IsOneOf(), string_base< storageT >::LeftTrim(), string_base< storageT >::RightTrim(), tFalse, and tTrue.

◆ operator const tChar *()

operator const tChar * ( ) const
inline

This useful casting operator provides an efficient method to access the null- terminated C string contained in a cStringA object.

No characters are copied; only a pointer is returned. Be careful with this operator. If you change a cStringA object after you have obtained the character pointer, you may cause a reallocation of memory that invalidates the pointer.

Returns
A character pointer to the string data.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1208 of file string.h.

References string_base< storageT >::GetPtr().

◆ operator!=() [1/2]

tBool operator!= ( const _myType strString) const
inline

Checks if a string not equals the cStringA object.

Parameters
[in]strStringThe string.
Returns
True if strings are not equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1320 of file string.h.

References string_base< storageT >::Compare().

◆ operator!=() [2/2]

tBool operator!= ( const tChar pString) const
inline

Checks if a string does not equal the cStringA object.

Parameters
pStringThe string.
Returns
True if strings are not equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1251 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ operator+=()

const _myType& operator+= ( const _myType strString)
inline

The += concatenation operator joins characters to the end of this string.

You should be aware that out-of-memory errors may occur whenever you use this concatenation operator because new storage may be allocated for characters added to this cStringA object.

Parameters
strString[in] second cStringA object to be concatenated.
Returns
Reference to accessed cStringA object.

Definition at line 1228 of file string.h.

References string_base< storageT >::Append().

◆ operator<() [1/2]

tBool operator< ( const _myType strString) const
inline

Checks if a string is lexicographically greater than the cStringA object.

Parameters
[in]strStringThe string.
Returns
True if strString is greater
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1331 of file string.h.

References string_base< storageT >::Compare().

◆ operator<() [2/2]

tBool operator< ( const tChar pString) const
inline

Checks if a string is lexicographically greater than the cStringA object.

Parameters
[in]pStringThe string.
Returns
True if pString is greater
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1262 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ operator<=() [1/2]

tBool operator<= ( const _myType strString) const
inline

Checks if a string is lexicographically greater than or equal to the cStringA object.

Parameters
[in]strStringThe string.
Returns
True if strString is greater or equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1354 of file string.h.

References string_base< storageT >::Compare().

◆ operator<=() [2/2]

tBool operator<= ( const tChar pString) const
inline

Checks if a string is lexicographically greater than or equal to the cStringA object.

Parameters
[in]pStringThe string.
Returns
True if pString is greater or equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1285 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ operator=() [1/5]

string_base& operator= ( _myType &&  strValue)
inline

The cString assignment (=) operator assigns a new value to the existing cString object.

Parameters
strValue[in] string value to be assigned.
Returns
Reference to cString object.

Definition at line 104 of file string.h.

References string_base< storageT >::Set().

◆ operator=() [2/5]

string_base& operator= ( const _myType strValue)
inline

The cString assignment (=) operator assigns a new value to the existing cString object.

Parameters
strValue[in] string value to be assigned.
Returns
Reference to cString object.

Definition at line 89 of file string.h.

References string_base< storageT >::Set().

◆ operator=() [3/5]

string_base& operator= ( const _StorageType strValue)
inline

The cString assignment (=) operator assigns a new value to the existing cString object.

Parameters
strValue[in] string value to be assigned.
Returns
Reference to cString object.

Definition at line 128 of file string.h.

References string_base< storageT >::m_oStorageBuffer.

◆ operator=() [4/5]

string_base& operator= ( const tChar strValue)
inline

The cString assignment (=) operator assigns a new value to the existing cString object.

Parameters
strValue[in] string value to be assigned.
Returns
Reference to cString object.

Definition at line 139 of file string.h.

References string_base< storageT >::Set().

◆ operator=() [5/5]

string_base& operator= ( const tChar strValue)
inline

The cString assignment (=) operator assigns a new value to the existing cString object.

Parameters
strValue[in] string value to be assigned.
Returns
Reference to cString object.

Definition at line 160 of file string.h.

References string_base< storageT >::Set().

◆ operator==() [1/2]

tBool operator== ( const _myType strString) const
inline

Checks if a string equals the cStringA object.

Parameters
[in]strStringThe string.
Returns
True if strings are equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1309 of file string.h.

References string_base< storageT >::Compare().

◆ operator==() [2/2]

tBool operator== ( const tChar pString) const
inline

Checks if a string equals the cStringA object.

Parameters
[in]pStringThe string.
Returns
True if strings are equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1240 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ operator>() [1/2]

tBool operator> ( const _myType strString) const
inline

Checks if a string is lexicographically smaller than the cStringA object.

Parameters
[in]strStringThe string.
Returns
True if strString is smaller
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1342 of file string.h.

References string_base< storageT >::Compare().

◆ operator>() [2/2]

tBool operator> ( const tChar pString) const
inline

Checks if a string is lexicographically smaller than the cStringA object.

Parameters
[in]pStringThe string.
Returns
True if pString is smaller
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1273 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ operator>=() [1/2]

tBool operator>= ( const _myType strString) const
inline

Checks if a string is lexicographically smaller than or equal to the cStringA object.

Parameters
[in]strStringThe string.
Returns
True if strString is smaller or equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1366 of file string.h.

References string_base< storageT >::Compare().

◆ operator>=() [2/2]

tBool operator>= ( const tChar pString) const
inline

Checks if a string is lexicographically smaller than or equal to the cStringA object.

Parameters
[in]pStringThe string.
Returns
True if pString is smaller or equal
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1297 of file string.h.

References cStringUtil::Compare(), and string_base< storageT >::GetPtr().

◆ operator[]() [1/2]

tChar& operator[] ( tSize  nIdx)
inline

array access operator

Parameters
nIdx[in] Zero-based index of the character in the cStringA object. The nIndex parameter must be greater than or equal to 0 and less than the value returned by GetLength.
Returns
reference to the character

Definition at line 426 of file string.h.

References string_base< storageT >::m_oStorageBuffer.

◆ operator[]() [2/2]

const tChar& operator[] ( tSize  nIdx) const
inline

array access operator

Parameters
nIdx[in] Zero-based index of the character in the cStringA object. The nIndex parameter must be greater than or equal to 0 and less than the value returned by GetLength.
Returns
reference to the character

Definition at line 414 of file string.h.

References string_base< storageT >::m_oStorageBuffer.

◆ Repeat()

static _myType Repeat ( tChar  c,
tSize  nCount 
)
inlinestatic

Creates a string from a repeated character.

Parameters
c[in] Character value to be assigned.
nCount[in] Repeat count of the character to be assigned.
Returns
The function returns the repetitive string.

Definition at line 2003 of file string.h.

◆ Replace() [1/2]

tSize Replace ( const _myType strOld,
const _myType strNew,
tBool  bReplaceAll = tTrue 
)
inline

This function replaces one substring by another.

Parameters
strOld[in] The character to be replaced by cNew.
strNew[in] The character replacing chOld.
bReplaceAll[in] If true, all instances are replaced, otherwise just the first instance is replaced.
Returns
The function returns the number of replaced instances of the string.

Definition at line 995 of file string.h.

References string_base< storageT >::Append(), string_base< storageT >::Find(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), string_base< storageT >::m_oStorageBuffer, and string_base< storageT >::Mid().

◆ Replace() [2/2]

tSize Replace ( tChar  cOld,
tChar  cNew,
tBool  bReplaceAll = tTrue 
)
inline

This function replaces one character by another.

Parameters
cOld[in] The character to be replaced by cNew.
cNew[in] The character replacing chOld.
bReplaceAll[in] If true, all instances are replaced, otherwise just the first instance is replaced.
Returns
The function returns the number of replaced instances of the character.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 1047 of file string.h.

References string_base< storageT >::begin(), string_base< storageT >::end(), and string_base< storageT >::IsEmpty().

◆ RFind()

tSize RFind ( tChar  cChar,
tSize  nStart = 0 
) const
inline

This function searches the cStringA object for the last match of the specified character.

Parameters
cChar[in] A single character to search for.
nStart[in] The index of the character in the string to begin the search with, or 0 to start from the end.
Returns
The zero-based index of the last character in this cStringA object that matches the requested character; -1 if the character is not found.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 884 of file string.h.

References string_base< storageT >::GetLength(), and string_base< storageT >::m_oStorageBuffer.

◆ Right()

_myType Right ( tSize  nLength) const
inline

Extracts the last (that is, rightmost) nLength characters from the cStringA object and returns a copy of the extracted substring.

If nLength exceeds the string length, then the entire string is extracted. If nLength is less than zero, an emtpy string will be returned. Right is similar to the Basic RIGHT$ function (except that indexes are zero-based).

Parameters
nLength[in] The number of characters to extract from this cStringA object.
Returns
A cStringA object that contains a copy of the specified range of characters. Note that the returned cStringA object may be empty.

Definition at line 1468 of file string.h.

References string_base< storageT >::GetLength(), and string_base< storageT >::SubString().

Referenced by string_base< storageT >::EndsWith().

◆ Set() [1/3]

_myType& Set ( const _myType strStringToSet,
tSize  nLength = InvalidPos 
)
inline

Assigns a new value to a cStringA object.

Parameters
strStringToSet[in] String value to be assigned.
nLength[in] Number of characters to be taken from the source string. As default, the complete string is copied.
Returns
The function returns the reference to the string.

Definition at line 240 of file string.h.

References string_base< storageT >::InvalidPos, and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::string_base(), string_base< storageT >::Copy(), cStringPiece::CopyToString(), string_base< storageT >::Escape(), string_base< storageT >::operator=(), and string_base< storageT >::Unescape().

◆ Set() [2/3]

_myType& Set ( const tChar pString,
tSize  nLength = InvalidPos 
)
inline

Assigns a new value to a cStringA object.

Parameters
pString[in] Null-terminated string value to be assigned.
nLength[in] Number of characters to be taken from the source string. As default, the complete string is copied.
Returns
The function returns the reference to the string.

Definition at line 263 of file string.h.

References string_base< storageT >::InvalidPos, and string_base< storageT >::m_oStorageBuffer.

◆ Set() [3/3]

_myType& Set ( tChar  c,
tSize  nCount 
)
inline

Assigns a new value to a cStringA object.

Parameters
c[in] Character value to be assigned.
nCount[in] Repeat count of the character to be assigned.
Returns
The function returns the reference to the string.

Definition at line 289 of file string.h.

References string_base< storageT >::InvalidPos, and string_base< storageT >::m_oStorageBuffer.

◆ SetAt()

tVoid SetAt ( tSize  nIdx,
tChar  c 
)
inline

The SetAt member function sets a single character at a specified position.

Parameters
nIdx[in] Zero-based index of the character in the cStringA object. The nIndex parameter must be greater than or equal to 0 and less than the value returned by GetLength.
c[in] Character to be set at the specified position.
Returns
tVoid
This method is real-time safe.\nSee @ref page_real_time_safe.\n

Definition at line 398 of file string.h.

References string_base< storageT >::GetLength(), and string_base< storageT >::m_oStorageBuffer.

◆ SetBuffer()

tSize SetBuffer ( tSize  szSize)
inline

Sets or resizes the internal string buffer.

Contents are preserved as long as resized buffer is large enough to hold the data. If the buffer size is reduced the content is cut off at the block border.

Parameters
szSize[in] Number of characters to allocate memory for.
Returns
If the buffer is allocated, the function returns the new size of the buffer. If there is insufficient memory for the allocation request, the function returns InvalidPos.

Definition at line 328 of file string.h.

References string_base< storageT >::GetBufferSize(), string_base< storageT >::InvalidPos, and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Escape(), string_base< storageT >::Filter(), string_base< storageT >::Format(), string_base< storageT >::ToStringFromType(), and string_base< storageT >::Unescape().

◆ Split() [1/2]

tVoid Split ( string_list_base< _myType > &  lstSplittedResult,
const _myType strToken 
) const
inline

This function splits up a single cStringA object into several parts using a token string.

Use this function to do simple parsing of joined string arrays.

Parameters
lstSplittedResult[in,out] Reference to cStringAList object that should be filled. The list is cleaned first.
strToken[in] Token string to be handled as separator key.
Returns
tVoid

Definition at line 1512 of file string.h.

References string_list_base< storageT >::Append(), string_list_base< storageT >::Clear(), string_base< storageT >::EndsWith(), string_base< storageT >::Find(), string_base< storageT >::GetLength(), string_base< storageT >::InvalidPos, string_base< storageT >::IsEmpty(), and string_base< storageT >::Mid().

◆ Split() [2/2]

tVoid Split ( string_list_base< _myType > &  lstSplittedResult,
tChar  cToken 
) const
inline

This function splits up a single cStringA object into several parts using a token character.

Use this function to do simple parsing of joined string arrays.

Parameters
lstSplittedResult[in,out] Reference to cStringAList object that should be filled. The list is cleaned first.
cToken[in] Token to be handled as separator character.
Returns
tVoid

Definition at line 1495 of file string.h.

◆ SplitToken()

tVoid SplitToken ( string_list_base< _myType > &  lstList,
const _myType strTokenList 
) const
inline

Split string using a token list.

This function splits up a single cStringA object into several parts using a token list. If multiple token are directly appended, no empty entries are added to List i.e. Token '>' and '<' and a string like "foo<>bar" will create a List with "foo" and "bar"

Parameters
lstList[in,out] Reference to cStringAList object that should be filled. The list is cleaned first.
strTokenList[in] Token list to be used as separator characters.
Returns
tVoid

Definition at line 1569 of file string.h.

References string_list_base< storageT >::Append(), string_list_base< storageT >::Clear(), string_base< storageT >::FindToken(), string_base< storageT >::InvalidPos, string_base< storageT >::IsNotEmpty(), and string_base< storageT >::Mid().

◆ StartsWith()

tBool StartsWith ( const _myType strStartsWith,
const tBool  bNoCase = tFalse 
) const
inline

This function checks if the string starts with a given prefix.

Parameters
strStartsWith[in] The prefix to check for.
bNoCase[in] Whether or not to check case insensitive or not.
Returns
tTrue if it starts with the prefix, otherwise tFalse.

Definition at line 1131 of file string.h.

References string_base< storageT >::Compare(), string_base< storageT >::CompareNoCase(), string_base< storageT >::GetLength(), string_base< storageT >::IsEmpty(), and tFalse.

◆ SubString()

_myType SubString ( tSize  nPos,
tSize  nLength = InvalidPos 
) const
inline

This function extracts a substring of length nLength characters from the cStringA object, starting at position nPos (zero-based).

The function returns a copy of the extracted substring.

Parameters
nPos[in] The zero-based index of the first character in the cStringA object that is to be included in the extracted substring.
nLength[in] The number of characters to extract from this cStringA object. If this parameter is not supplied, then the remainder of the string is extracted.
Returns
A cStringA object that contains a copy of the specified range of characters. Note that the returned cStringA object may be empty.

Definition at line 1387 of file string.h.

References string_base< storageT >::Empty, string_base< storageT >::GetLength(), and string_base< storageT >::m_oStorageBuffer.

Referenced by string_base< storageT >::Left(), string_base< storageT >::Mid(), and string_base< storageT >::Right().

◆ ToLower()

tVoid ToLower ( )
inline

This function converts a cStringA object to a lowercase string.

This method is real-time safe.\nSee @ref page_real_time_safe.\n
Returns
tVoid

Definition at line 1745 of file string.h.

References string_base< storageT >::begin(), string_base< storageT >::end(), and string_base< storageT >::IsEmpty().

Referenced by string_base< storageT >::Find().

◆ ToStringFromType()

static _myType ToStringFromType ( oValue,
const _myType strFormat 
)
inlinestatic

This function creates a new cString object from a numeric value.

The numeric data is converted to an unformatted string.

Parameters
[in]oValueNumeric value.
[in]strFormatFormat definition (see Format).
Returns
New cString object containing the string representation of the number.

Definition at line 2430 of file string.h.

References cStringUtil::FromType(), string_base< storageT >::GetBuffer(), string_base< storageT >::GetBufferSize(), string_base< storageT >::GetMaxBufferSize(), string_base< storageT >::GetPtr(), and string_base< storageT >::SetBuffer().

Referenced by string_base< storageT >::FromType().

◆ ToType() [1/7]

tVoid ToType ( tBool bValue) const
inline

This function converts the string to a boolean value.

Only the following strings will be interpreted as true (not case sensitive): "true","on","1", all other strings will be interpreted as false. If a string is concatenate by a true-literal (and vice versa) it is interpreted as false.

Parameters
[out]bValueReference to boolean variable where the converted string should be stored.
Returns
tVoid

Definition at line 2322 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

◆ ToType() [2/7]

tVoid ToType ( tFloat32 f32Value) const
inline

This function converts the string to a floating-point value.

The string has to be in the following format to be interpreted as a float: [whitespace][sign][digits][(.|,)digits][{d|D|e|E}[sign]digits]. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". Both '.' and ',' are interpreted as decimal point.

Parameters
[out]f32ValueReference to floating-point variable where the converted string should be stored.
Returns
tVoid

Definition at line 2276 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

◆ ToType() [3/7]

tVoid ToType ( tFloat64 f64Value) const
inline

This function converts the string to a floating-point value.

The string has to be in the following format to be interpreted as a float: [whitespace][sign][digits][(.|,)digits][{d|D|e|E}[sign]digits]. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". Both '.' and ',' are interpreted as decimal point.

Parameters
[out]f64ValueReference to floating-point variable where the converted string should be stored.
Returns
tVoid

Definition at line 2229 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

◆ ToType() [4/7]

tVoid ToType ( tInt32 i32Value) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt().
Parameters
[out]i32ValueReference to integer variable where the converted string should be stored.
Returns
tVoid

Definition at line 2037 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

Referenced by string_base< storageT >::AsBool(), string_base< storageT >::AsFloat32(), string_base< storageT >::AsFloat64(), string_base< storageT >::AsInt32(), string_base< storageT >::AsInt64(), string_base< storageT >::AsUInt32(), and string_base< storageT >::AsUInt64().

◆ ToType() [5/7]

tVoid ToType ( tInt64 i64Value) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt(). If there is a negative integer, the 0 will be returned. A number with the prefix "+" will be correctly interpreted.
Parameters
[out]i64ValueReference to integer variable where the converted string should be stored.
Returns
tVoid

Definition at line 2134 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

◆ ToType() [6/7]

tVoid ToType ( tUInt32 ui32Value) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt(). If there is a negative integer, the 0 will be returned. A number with the prefix "+" will be correctly interpreted
Parameters
[out]ui32ValueReference to unsigned integer variable where the converted string should be stored.
Returns
tVoid

Definition at line 2084 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

◆ ToType() [7/7]

tVoid ToType ( tUInt64 ui64Value) const
inline

This function converts the string to an integer value.

The function stops reading at the first character, that is not part of a number. i.e. "123abc" can be converted, but "abc123" not. If the number is written as a hex-number the string can be converted, too. i.e "0x4fff abc". More Information about converting hex-numbers see

See also
HexToInt().
Parameters
[out]ui64ValueReference to integer variable where the converted string should be stored.
Returns
tVoid

Definition at line 2182 of file string.h.

References string_base< storageT >::GetPtr(), and cStringUtil::ToType().

◆ ToUpper()

tVoid ToUpper ( )
inline

This function converts a cStringA object to an uppercase string.

This method is real-time safe.\nSee @ref page_real_time_safe.\n
Returns
tVoid

Definition at line 1767 of file string.h.

References string_base< storageT >::begin(), string_base< storageT >::end(), and string_base< storageT >::IsEmpty().

◆ Trim()

tVoid Trim ( )
inline

This function removes leading and trailing whitespace characters from a cStringA object.

Returns
tVoid

Definition at line 1607 of file string.h.

References string_base< storageT >::LeftTrim(), and string_base< storageT >::RightTrim().

◆ Unescape()

_myType& Unescape ( )
inline