ADTF  v2.14.3
cString Class Reference

Class for string handling. More...

Inheritance diagram for cString:

Public Types

typedef std::string::value_type value_type
 type of string
 
typedef std::string::size_type size_type
 size of string
 

Public Member Functions

 cString ()
 Constructor that initializes an empty cString object.
 
 cString (const tChar *pString)
 Constructor that initializes the string with a null-terminated string. More...
 
 cString (const tChar *pString, tSize nCount)
 Constructor that initializes the object with characters from a string. More...
 
 cString (tChar cChar)
 Constructor that initializes the string with a single character. More...
 
 cString (const cString &strString)
 Constructor that initializes the string with an existing string object. More...
 
virtual ~cString ()
 Destructor.
 
OPT_INLINE void Clear ()
 Makes this cString object an empty string and frees memory as appropriate.
 
OPT_INLINE cStringSet (const cString &strString, tInt nLength=-1)
 Assigns a new value to a cString object. More...
 
OPT_INLINE cStringSet (const tChar *pString, tInt nLength=-1)
 Assigns a new value to a cString object. More...
 
OPT_INLINE cStringSet (tChar c, tInt nLength=1)
 Assigns a new value to a cString object. More...
 
OPT_INLINE tInt GetLength () const
 This function returns the number of characters in a cString object. More...
 
tBool SetBuffer (tInt nLength)
 Sets or resizes the internal string buffer. More...
 
tInt GetBufferSize ()
 Get the size of the internal allocated string buffer. More...
 
tChar GetAt (tInt nIdx) const
 You can think of a cString object as an array of characters. More...
 
void SetAt (tInt nIdx, tChar c)
 The SetAt member function sets a single character at a specified position. More...
 
const tCharoperator[] (tUInt nIdx) const
 array access operator More...
 
tCharoperator[] (tUInt nIdx)
 array access operator More...
 
OPT_INLINE tBool IsEmpty () const
 This function checks if the string object is empty. More...
 
OPT_INLINE tBool IsNotEmpty () const
 This function checks if the string object is not empty. More...
 
const tCharGetPtr () const
 This function returns the current string as a array of characters (c-style) More...
 
const cStringAppend (const cString &strString)
 This function appends a string to the end of the cString object. More...
 
const cStringAppend (tChar c)
 This function appends one character to the end of the cString object. More...
 
const cStringDelete (tInt nPos, tInt nLength=-1)
 This function deletes a substring of length nLength characters from the cString object, starting at position nPos (zero-based). More...
 
const cStringInsert (const cString &strString, tInt nPos, tInt nLength=-1)
 This function inserts a string into the cString object. More...
 
const cStringInsert (const tChar *pString, tInt nPos, tInt nLength=-1)
 This function inserts a string into the cString object. More...
 
OPT_INLINE tInt Compare (const cString &strString) const
 This function compares a cString object with another string using the generic-text function _tcscmp. More...
 
OPT_INLINE tInt Compare (const cString &strString, tInt nPos, tInt nLength=-1) const
 This function compares a cString object with another string using the generic-text function _tcscmp. More...
 
OPT_INLINE tInt CompareNoCase (const cString &strString) const
 This function compares a cString object with another string using the generic-text function _tcsicmp. More...
 
OPT_INLINE tInt CompareNoCase (const cString &strString, tInt nPos, tInt nLength=-1) const
 This function compares a cString object with another string using the generic-text function _tcsicmp. More...
 
OPT_INLINE tBool IsEqual (const cString &strCmp) const
 This function checks if the two strings are equal (case sensitive) More...
 
OPT_INLINE tBool IsEqual (const cString &strCmp, tInt nPos, tInt nLength=-1) const
 This function checks if the two strings are equal (case sensitive) More...
 
OPT_INLINE tBool IsEqualNoCase (const cString &strCmp) const
 This function checks if the two strings are equal (case insensitive) More...
 
OPT_INLINE tBool IsEqualNoCase (const cString &strCmp, tInt nPos, tInt nLength=-1) const
 This function checks if the two strings are equal (case insensitive) More...
 
OPT_INLINE tBool IsNotEqual (const cString &strCmp) const
 This function checks if the two strings are not equal (case sensitive) More...
 
OPT_INLINE tBool IsNotEqual (const cString &strCmp, tInt nPos, tInt nLength=-1) const
 This function checks if the two strings are not equal (case sensitive) More...
 
OPT_INLINE tBool IsNotEqualNoCase (const cString &strCmp) const
 This function checks if the two strings are not equal (case insensitive) More...
 
OPT_INLINE tBool IsNotEqualNoCase (const cString &strCmp, tInt nPos, tInt nLength=-1) const
 This function checks if the two strings are not equal (case insensitive) *. More...
 
tInt Find (const cString &strString, tInt nStart=0, tBool bNoCase=tFalse) const
 This function searches the cString object for the first match of a substring. More...
 
tInt Find (const tChar cChar, tInt nStart=0) const
 This function searches the cString object for the first match of the specified character. More...
 
tInt RFind (const tChar cChar, tInt nStart=-1) const
 This function searches the cString object for the last match of the specified character. More...
 
tInt FindToken (const cString &strTokenList, tInt nStart=0) const
 This function searches a string for the first character that matches any character contained in a token list. More...
 
tInt FindNotToken (const cString &strTokenList, tInt nStart=0) const
 This function searches a string for the first character that matches none of the characters contained in a token list. More...
 
tInt CountString (const cString &strFind, tInt nStart=0) const
 This counts the occurrences of a given substring in a string. More...
 
tInt Replace (const cString &strOld, const cString &strNew, tBool bReplaceAll=true)
 This function replaces one substring by another. More...
 
tInt Replace (tChar cOld, tChar cNew, tBool bReplaceAll=true)
 This function replaces one character by another. More...
 
tInt Filter (tChar cChar)
 This function removes all occurrences of a given character from a string. More...
 
tInt Filter (const cString &strCharList)
 This function removes all occurrences of each character given in a token list. More...
 
tBool StartsWith (const cString &strString, const tBool bNoCase=tFalse) const
 This function checks if the string starts with a given prefix. More...
 
tBool EndsWith (const cString &strString, const tBool bNoCase=tFalse) const
 This function checks if the string ends with a given postfix. More...
 
OPT_INLINE operator const tChar * () const
 This useful casting operator provides an efficient method to access the null- terminated C string contained in a cString object. More...
 
cStringoperator= (tChar cChar)
 The cString assignment (=) operator reinitializes an existing cString object with new data. More...
 
cStringoperator= (const tChar *pString)
 The cString assignment (=) operator reinitializes an existing cString object with new data. More...
 
cStringoperator= (const cString &strString)
 The cString assignment (=) operator reinitializes an existing cString object with new data. More...
 
const cStringoperator+= (const cString &strString)
 The += concatenation operator joins characters to the end of this string. More...
 
tBool operator== (const tChar *pString) const
 Checks if a strings equals the cString object. More...
 
tBool operator!= (const tChar *pString) const
 Checks if a strings not equals the cString object. More...
 
tBool operator< (const tChar *pString) const
 Checks if a strings is lexicographically greater than the cString object. More...
 
tBool operator> (const tChar *pString) const
 Checks if a strings is lexicographically smaller than the cString object. More...
 
tBool operator<= (const tChar *pString) const
 Checks if a strings is lexicographically greater than or equal to the cString object. More...
 
tBool operator>= (const tChar *pString) const
 Checks if a strings is lexicographically smaller than or equal to the cString object. More...
 
tBool operator== (const cString &strString) const
 Checks if a strings equals the cString object. More...
 
tBool operator!= (const cString &strString) const
 Checks if a strings not equals the cString object. More...
 
tBool operator< (const cString &strString) const
 Checks if a strings is lexicographically greater than the cString object. More...
 
tBool operator> (const cString &strString) const
 Checks if a strings is lexicographically smaller than the cString object. More...
 
tBool operator<= (const cString &strString) const
 Checks if a strings is lexicographically greater than or equal to the cString object. More...
 
tBool operator>= (const cString &strString) const
 Checks if a strings is lexicographically smaller than or equal to the cString object. More...
 
cString Mid (tInt nPos, tInt nLength=-1) const
 This function extracts a substring of length nLength characters from the cString object, starting at position nPos (zero-based). More...
 
cString Left (tInt nLength) const
 Extracts the first (that is, leftmost) nLength characters from the cString object and returns a copy of the extracted substring. More...
 
cString Right (tInt nLength) const
 Extracts the last (that is, rightmost) nLength characters from the cString object and returns a copy of the extracted substring. More...
 
void Split (cStringList &List, tChar cToken) const
 This function splits up a single cString object into several parts using a token character. More...
 
void Split (cStringList &List, const cString &strToken) const
 This function splits up a single cString object into several parts using a token string. More...
 
void SplitToken (cStringList &List, const cString &sTokenList) const
 Split string using a token list. More...
 
void Trim ()
 This function removes leading and trailing whitespace characters from a cString object.
 
void LeftTrim ()
 This function removes leading whitespace characters from a cString object.
 
void RightTrim ()
 This function removes trailing whitespace characters from a cString object.
 
void NumTrim ()
 This function removes whitespace and redundant zero characters from a cString object. More...
 
void DropQuotes ()
 This function removes quotes from a cString object. More...
 
void ToLower ()
 This function converts a cString object to a lowercase string. More...
 
void ToUpper ()
 This function converts a cString object to a uppercase string. 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...
 
cStringEscape ()
 Escape control characters. More...
 
cStringUnescape ()
 Unescape control characters. More...
 
int AsInt () const
 This function converts the string to an integer value. More...
 
tInt32 AsInt32 () const
 This function converts the string to an integer value. More...
 
tUInt32 AsUInt32 () const
 This function converts the string to an integer value. More...
 
tInt64 AsInt64 () const
 This function converts the string to an integer value. More...
 
tUInt64 AsUInt64 () 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...
 
tBool AsBool () const
 This function converts the string to a boolean value. More...
 
tInt HexToInt () const
 This function converts a hexadecimal string representation to an integer value. More...
 
tInt64 HexToInt64 () const
 This function converts a hexadecimal string representation to an integer value. More...
 
const tCharc_str () const )
 Use GetPtr() instead.
 
 cString (const std::string &strString))
 Pass std::string::c_str() instead.
 
std::string & AsStdString ())
 Use GetPtr() instead.
 
const std::string & AsStdString () const )
 Use GetPtr() instead.
 
const tChardata () const )
 Use GetPtr() instead.
 
size_t size () const )
 Use GetLength() instead.
 
size_t length () const )
 Use GetLength() instead.
 
void clear ())
 Use Clear() instead.
 
bool empty () const )
 Use IsEmpty() instead.
 
std::string & append (const std::string &str))
 Use Append() instead.
 
std::string & append (const char *s))
 Use Append() instead.
 
std::string & append (const cString &str))
 Use Append() instead.
 
std::string & assign (const char *s, size_t n))
 Use Set() instead.
 
size_t find (const std::string &str, size_t pos=0) const )
 Use Find() instead.
 
size_t find (const char *s, size_t pos=0) const )
 Use Find() instead.
 
size_t find (char c, size_t pos=0) const )
 Use Find() instead.
 
size_t find (const cString &str, size_t pos=0) const )
 Use Find() instead.
 
size_t rfind (const std::string &str, size_t pos=std::string::npos) const )
 Use RFind() instead.
 
size_t rfind (char c, size_t pos=std::string::npos) const )
 Use RFind() instead.
 
size_t find_first_of (const std::string &str, size_t pos=0) const )
 Use FindToken() instead.
 
size_t find_first_of (char c, size_t pos=0) const )
 Use FindToken() instead.
 
size_t find_last_of (const std::string &str, size_t pos=std::string::npos) const )
 No replacement.
 
size_t find_last_of (char c, size_t pos=std::string::npos) const )
 No replacement.
 
size_t find_first_not_of (const std::string &str, size_t pos=0) const )
 Use FindNotToken() instead.
 
size_t find_first_not_of (char c, size_t pos=0) const )
 Use FindNotToken() instead.
 
size_t find_last_not_of (const std::string &str, size_t pos=std::string::npos) const )
 No replacement.
 
size_t find_last_not_of (char c, size_t pos=std::string::npos) const )
 No replacement.
 
std::string substr (size_t pos=0, size_t len=std::string::npos) const )
 Use Mid() instead.
 
int compare (const std::string &str) const )
 Use Compare() instead.
 
int compare (const cString &str) const )
 Use Compare() instead.
 
int compare (const char *s) const )
 Use Compare() instead.
 

Static Public Member Functions

static tInt GetLength (const tChar *pcStr)
 This function returns the number of characters in a char string object. More...
 
static tInt Compare (const tChar *str1, const tChar *str2, tInt nLength=-1)
 This function compares two given strings using the generic-text function _tcscmp. More...
 
static tInt Compare (const std::string &str1, const std::string &str2, tInt nLength=-1)
 This function compares two given strings using the generic-text function _tcscmp. More...
 
static tInt CompareNoCase (const tChar *str1, const tChar *str2, tInt nLength=-1)
 This function compares a cString object with another string using the generic-text function _tcsicmp. More...
 
static tInt CompareNoCase (const std::string &str1, const std::string &str2, tInt nLength=-1)
 This function compares a cString object with another string using the generic-text function _tcsicmp. More...
 
static tBool IsEqual (const tChar *str1, const tChar *str2)
 This function checks if the two strings are equal (case sensitive) More...
 
static tBool IsEqual (const std::string &str1, const std::string &str2)
 This function checks if the two strings are equal (case sensitive) More...
 
static tBool IsEqualNoCase (const tChar *str1, const tChar *str2)
 This function checks if the two strings are equal (case insensitive) More...
 
static tBool IsEqualNoCase (const std::string &str1, const std::string &str2)
 This function checks if the two strings are equal (case insensitive) More...
 
static tBool IsNotEqual (const tChar *str1, const tChar *str2)
 This function checks if the two strings are not equal (case sensitive) More...
 
static tBool IsNotEqual (const std::string &str1, const std::string &str2)
 This function checks if the two strings are not equal (case sensitive) More...
 
static tBool IsNotEqualNoCase (const tChar *str1, const tChar *str2)
 This function checks if the two strings are not equal (case insensitive) More...
 
static tBool IsNotEqualNoCase (const std::string &str1, const std::string &str2)
 This function checks if the two strings are not equal (case insensitive) More...
 
static tBool IsWhiteChar (tChar c)
 This function checks if a given tChar value is a whitespace character. More...
 
static tBool IsSymbolChar (tChar c)
 This function checks if a given tChar value is valid to be used in a symbol name. More...
 
static tBool IsNumber (tChar c)
 This function checks if a tChar is a number. More...
 
static cString Repeat (tChar c, tInt nCount)
 This function creates a new cString object by repeating one single character. More...
 
static cString FromInt32 (tInt32 nValue, const cString &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static cString FromUInt32 (tUInt32 nValue, const cString &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static cString FromInt64 (tInt64 nValue, const cString &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static cString FromUInt64 (tUInt64 nValue, const cString &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static cString FromBool (tBool bValue)
 This function creates a new cString object from a boolean value. More...
 
static cString FromFloat64 (tFloat64 fValue, const cString &strFormat=Empty)
 This function creates a new cString object from a double value. More...
 
static cString FromInt (int nValue, const cString &strFormat=Empty)
 This function creates a new cString object from a numeric value. More...
 
static cString Format (const tChar *strFormat,...)
 Write formatted data to a string. More...
 
static tCharCopy (tChar *pstrDestination, const tChar *pstrSource, tInt nCount=-1, tInt nDestinationBufferSize=-1)
 Copies a null terminated string to another string buffer. More...
 
static cString Copy (cString &strDestination, const cString &strSource, tInt nCount=-1)
 Copies the value of one cString object to another cString object. More...
 
static tInt Scan (const tChar *sSource, const tChar *sFormat,...)
 This function reads data from the input string and writes the data into the location(s) given by arguments. More...
 

Static Public Attributes

static const cString Empty
 Internally used empty string.
 
static const std::string::size_type npos
 string position More...
 

Protected Member Functions

void TrimFunc (tBool bLeft, tBool bRight, tBool bNumeric)
 This function trims the string. More...
 

Static Protected Member Functions

static cString IntToStr (int n)
 Convert integer to string. More...
 
static cString Int64ToStr (tInt64 n)
 Convert 64-bit integer to string. More...
 
static cString UInt64ToStr (tUInt64 ui64Value)
 Convert 64-bit unsigned integer to string. More...
 

Static Protected Attributes

static const tCharm_pcSafeBuffer
 Internally used character buffer.
 

Friends

cString operator+ (const cString &str1, const cString &str2)
 The + concatenation operator joins two strings and returns a CString object. More...
 
cString operator+ (const tChar *str1, const cString &str2)
 The + concatenation operator joins two strings and returns a CString object. More...
 
cString operator+ (const cString &str1, const tChar *str2)
 The + concatenation operator joins two strings and returns a CString object. More...
 

Detailed Description

Class for string handling.

This class implements the basic string handling functionality.

Warning
It is not recommended to use adtf_util::cString with binary data. To work with binary data sets, please use a vector of characters like "vector<tChar>" instead of adtf_util::cString.
Note
The cString class does not inherit from std::string anymore. By eliminating the direct dependency to the std::string, the usage of the cString class becomes much more robust and safe.
A short rationale: The state of an object of type cString directly depends on the state of the std::string object it uses. By publicly exposing the std::string object to the user, the state of that object might have been changed whereas the state of the cString depending on that std::string object won't notice these changes. Further uses of that cString object would result in undefined behavior, because that object would refer to the changed object of type std::string.
Due to the changes there are some restrictions the user has to take care of.
  • Methods offered by std::string are not supported anymore
  • Implicit casting to std::string is not supported anymore
To illustrate both points, take a look at the following code snippet.
int foostr(std::string & str)
{
return 0;
}
int foostr_const(const std::string & str)
{
return 0;
}
int foost_const_char(const tChar* str)
{
return 0;
}
int main(void)
{
//code like the following two lines won't compile anymore
foostr(cStr); // (1)
foostr_const(cStr); // (2)
foost_const_char(cStr.c_str()); // (3)
//never do this, this results in undefined behavior!!!
foostr((std::string)cStr);
foostr_const((std::string)cStr);
foost_const_char((const tChar*)cStr);
return 0;
}
These and similar functions calls are not supported anymore as those directly used the std::string API. (3) can be worked around by using method cString::GetPtr(). (1) and (2) are not and won't be possible anymore.

Definition at line 82 of file string.h.

Constructor & Destructor Documentation

cString ( const tChar pString)

Constructor that initializes the string with a null-terminated string.

Parameters
pString[in] A null-terminated string to be copied into this cString object.
cString ( const tChar pString,
tSize  nCount 
)

Constructor that initializes the object with characters from a string.

Parameters
pString[in] A string to be copied into this cString object.
nCount[in] The maximum amount of characters that should be copied.
cString ( tChar  cChar)

Constructor that initializes the string with a single character.

Parameters
cChar[in] A single character.
cString ( const cString strString)

Constructor that initializes the string with an existing string object.

Parameters
strString[in] An existing cString object to be copied into this cString object.

Member Function Documentation

const cString& Append ( const cString strString)

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

Note
Please note that the string may only contain non-binary data!
Parameters
strString[in] cString object to be appended.
Returns
The function returns a reference to itself containing the new string contents.
const cString& Append ( tChar  c)

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

Note
Please note that appending a NULL-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.
tBool AsBool ( ) const

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
tFloat64 AsFloat64 ( ) const

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]. So hex numbers can not be interpreted! Both '.' and ',' are interpreted as decimal point.

Returns
Converted floating-point value, 0.0 if value can not be converted
int AsInt ( ) const

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
tInt32 AsInt32 ( ) const

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
tInt64 AsInt64 ( ) const

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
tUInt32 AsUInt32 ( ) const

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
tUInt64 AsUInt64 ( ) const

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
OPT_INLINE tInt Compare ( const cString strString) const

This function compares a cString 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
strString[in] The other string used for comparison.
Returns
Zero if the strings are identical, < 0 if the cString object is less than the string parameter strString, or > 0 if the cString object is greater than the string given in parameter strString.
This method is real-time safe.
See The ADTF Real-Time Extension.

Referenced by xml_string_compare_func::operator()(), and cStringCompareFunc::operator()().

OPT_INLINE tInt Compare ( const cString strString,
tInt  nPos,
tInt  nLength = -1 
) const

This function compares a cString 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 cString object is less than the string parameter strString, or > 0 if the cString object is greater than the string given in parameter strString.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tInt Compare ( const tChar str1,
const tChar str2,
tInt  nLength = -1 
)
static

This function compares two given strings 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]str1first string used for comparison.
[in]str2second string used for comparison.
[in]nLengthamount of characters to be compared. -1 means until end
Return values
static tInt Compare ( const std::string &  str1,
const std::string &  str2,
tInt  nLength = -1 
)
static

This function compares two given strings 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]str1first string used for comparison.
[in]str2second string used for comparison.
[in]nLengthamount of characters to be compared. -1 means until end
Return values
OPT_INLINE tInt CompareNoCase ( const cString strString) const

This function compares a cString 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.
Returns
Zero if the strings are identical (ignoring case), <0 if the cString object is less than parameter strString (ignoring case), or >0 if the cString object is greater the string given in parameter strString (ignoring case).
This method is real-time safe.
See The ADTF Real-Time Extension.

Referenced by cStringNoCaseCompareFunc::operator()().

OPT_INLINE tInt CompareNoCase ( const cString strString,
tInt  nPos,
tInt  nLength = -1 
) const

This function compares a cString 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 cString object is less than parameter strString (ignoring case), or >0 if the cString object is greater the string given in parameter strString (ignoring case).
This method is real-time safe.
See The ADTF Real-Time Extension.
static tInt CompareNoCase ( const tChar str1,
const tChar str2,
tInt  nLength = -1 
)
static

This function compares a cString 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
str1[in] First string for comparison.
str2[in] Second string for comparison.
nLength[in] Compare only nLength characters.
Return values
static tInt CompareNoCase ( const std::string &  str1,
const std::string &  str2,
tInt  nLength = -1 
)
static

This function compares a cString 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
str1[in] First string for comparison.
str2[in] Second string for comparison.
nLength[in] Compare only nLength characters.
Return values
static tChar* Copy ( tChar pstrDestination,
const tChar pstrSource,
tInt  nCount = -1,
tInt  nDestinationBufferSize = -1 
)
static

Copies a null terminated string to another string buffer.

This method ensures that the string stored in sDestination is null terminated:

  • by setting of pstrDestination[nDestinationBufferSize - 1] = '\0' if nCount > nDestinationBufferSize
  • by setting of pstrDestination[nDestinationBufferSize - 1] = '\0' if nCount is not set
  • by setting of pstrDestination[nCount] = '\0' if nCount < nDestinationBufferSize
  • by setting of pstrDestination[end] = '\0' if nCount and nDestinationBufferSize not set
Parameters
pstrDestination[out] NULL terminated Destination string.
pstrSource[in] NULL terminated Source string.
nCount[in] Number of characters to be copied from the source string to the destination string object.
nDestinationBufferSize[in] The size of the destination string buffer, no more than this amount of bytes will be copied (including the null byte). -1 = no limit (not recommended, prone to buffer overflows).
Remarks
Make sure nDestinationBufferSize is set to at least nCount+1!
Returns
The function returns a pointer to the destination string.

Referenced by cSampleSource::GetStreamInfo().

static cString Copy ( cString strDestination,
const cString strSource,
tInt  nCount = -1 
)
static

Copies the value of one cString object to another cString object.

Parameters
strDestination[out] Destination cString object.
strSource[in] Source cString object.
nCount[in] Number of characters to be copied from the source string to the destination string object.
Returns
The function returns the destination string.
tInt CountString ( const cString strFind,
tInt  nStart = 0 
) const

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.
See The ADTF Real-Time Extension.
const cString& Delete ( tInt  nPos,
tInt  nLength = -1 
)

This function deletes a substring of length nLength characters from the cString 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 cString object that is to be deleted.
nLength[in] The number of characters to delete from this cString object. If this parameter is not supplied, then the remainder of the string is deleted.
Returns
A copy of the resulting string.
void DropQuotes ( )

This function removes quotes from a cString object.

Quotes are '"' and '\''

tBool EndsWith ( const cString strString,
const tBool  bNoCase = tFalse 
) const

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

Parameters
strString[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.
cString& Escape ( )

Escape control characters.

Returns
New cString object containing the formatted data.
tInt Filter ( tChar  cChar)

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.
tInt Filter ( const cString strCharList)

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.
tInt Find ( const cString strString,
tInt  nStart = 0,
tBool  bNoCase = tFalse 
) const

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

Parameters
strString[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 cString object that matches the requested substring; -1 if the substring is not found.
tInt Find ( const tChar  cChar,
tInt  nStart = 0 
) const

This function searches the cString object for the first 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 beginning.
Returns
The zero-based index of the first character in this cString object that matches the requested characters; -1 if the character is not found.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt FindNotToken ( const cString strTokenList,
tInt  nStart = 0 
) const

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 also in the token list; -1 if there is no match.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt FindToken ( const cString strTokenList,
tInt  nStart = 0 
) const

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.
See The ADTF Real-Time Extension.
static cString Format ( const tChar strFormat,
  ... 
)
static

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
strFormat[in] Format control string.
Returns
New cString object containing the formatted data.
See also
cString::Format

Referenced by cPooledClassFactory< T >::CreateInstance(), cSampleClassFactory< T >::CreateInstance(), and LogFile::Flush().

static cString FromBool ( tBool  bValue)
static

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

Parameters
bValue[in] Boolean value.
Returns
Converted tBool value
static cString FromFloat64 ( tFloat64  fValue,
const cString strFormat = Empty 
)
static

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

Parameters
fValue[in] Double value.
strFormat[in] Format definition (see Format).
Returns
Converted tFloat64 value
static cString FromInt ( int  nValue,
const cString strFormat = Empty 
)
static

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

The numeric data is converted to an unformatted string.

Parameters
nValue[in] Numeric value.
strFormat[in] Format definition (see Format).
Returns
New cString object containing the string representation of the number.
static cString FromInt32 ( tInt32  nValue,
const cString strFormat = Empty 
)
static

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

The numeric data is converted to an unformatted string.

Parameters
nValue[in] Numeric value.
strFormat[in] Format definition (see Format).
Returns
New cString object containing the string representation of the number.
static cString FromInt64 ( tInt64  nValue,
const cString strFormat = Empty 
)
static

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

Parameters
nValue[in] Integer value.
strFormat[in] Format definition (see Format).
Returns
Converted tInt64 value
static cString FromUInt32 ( tUInt32  nValue,
const cString strFormat = Empty 
)
static

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

The numeric data is converted to an unformatted string.

Parameters
nValue[in] Numeric value.
strFormat[in] Format definition (see Format).
Returns
New cString object containing the string representation of the number.
static cString FromUInt64 ( tUInt64  nValue,
const cString strFormat = Empty 
)
static

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

Parameters
[in]nValueInteger value
[in]strFormatdefinition (see Format).
Returns
Converted tUInt64 value
tChar GetAt ( tInt  nIdx) const

You can think of a cString 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 cString 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.
See The ADTF Real-Time Extension.
tInt GetBufferSize ( )

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')).
OPT_INLINE tInt GetLength ( ) const

This function returns the number of characters in a cString object.

Returns
tInt value that contains the number of characters of a '\0' terminated cString object.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tInt GetLength ( const tChar pcStr)
static

This function returns the number of characters in a char string object.

Parameters
pcStr[in] Pointer to a char string object.
Returns
tInt value that contains the number of characters of a '\0' terminated string.
tInt HexToInt ( ) const

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

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

Returns
Converted integer value
tInt64 HexToInt64 ( ) const

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
const cString& Insert ( const cString strString,
tInt  nPos,
tInt  nLength = -1 
)

This function inserts a string into the cString 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
strString[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.
const cString& Insert ( const tChar pString,
tInt  nPos,
tInt  nLength = -1 
)

This function inserts a string into the cString 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
pString[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.
static cString Int64ToStr ( tInt64  n)
staticprotected

Convert 64-bit integer to string.

Parameters
n[in] Integer value.
Returns
Converted string value
static cString IntToStr ( int  n)
staticprotected

Convert integer to string.

Parameters
n[in] Integer value.
Returns
Converted string value
OPT_INLINE tBool IsEmpty ( ) const

This function checks if the string object is empty.

Returns
tBool value that is true, if the string object is empty.
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsEqual ( const cString strCmp) const

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

Parameters
strCmp[in] The other string used for comparison.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.

Referenced by cDDLCompareFunctor< T >::operator()().

OPT_INLINE tBool IsEqual ( const cString strCmp,
tInt  nPos,
tInt  nLength = -1 
) const

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.
See The ADTF Real-Time Extension.
static tBool IsEqual ( const tChar str1,
const tChar str2 
)
static

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

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsEqual ( const std::string &  str1,
const std::string &  str2 
)
static

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

Parameters
str1[in] A string to compare.
str2[in] A string to compare.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsEqualNoCase ( const cString strCmp) const

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

Parameters
strCmp[in] The other string used for comparison.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsEqualNoCase ( const cString strCmp,
tInt  nPos,
tInt  nLength = -1 
) const

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.
See The ADTF Real-Time Extension.
static tBool IsEqualNoCase ( const tChar str1,
const tChar str2 
)
static

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

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsEqualNoCase ( const std::string &  str1,
const std::string &  str2 
)
static

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

Parameters
str1[in] A string to compare.
str2[in] A string to compare.
Returns
tTrue if the two strings are equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool IsFloat ( ) const

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
tBool IsInteger ( ) const

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 a integer number
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsNotEmpty ( ) const

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.
See The ADTF Real-Time Extension.

Referenced by cSampleClassFactory< T >::CreateInstance(), and cSampleClassFactory< T >::cSampleClassFactory().

OPT_INLINE tBool IsNotEqual ( const cString strCmp) const

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

Parameters
strCmp[in] The other string used for comparison.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsNotEqual ( const cString strCmp,
tInt  nPos,
tInt  nLength = -1 
) const

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.
See The ADTF Real-Time Extension.
static tBool IsNotEqual ( const tChar str1,
const tChar str2 
)
static

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

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsNotEqual ( const std::string &  str1,
const std::string &  str2 
)
static

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

Parameters
str1[in] A string to compare.
str2[in] A string to compare.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsNotEqualNoCase ( const cString strCmp) const

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

Parameters
strCmp[in] The other string used for comparison.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
OPT_INLINE tBool IsNotEqualNoCase ( const cString strCmp,
tInt  nPos,
tInt  nLength = -1 
) const

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.
See The ADTF Real-Time Extension.
static tBool IsNotEqualNoCase ( const tChar str1,
const tChar str2 
)
static

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

Parameters
str1[in] A null-terminated string to compare.
str2[in] A null-terminated string to compare.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsNotEqualNoCase ( const std::string &  str1,
const std::string &  str2 
)
static

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

Parameters
str1[in] A string to compare.
str2[in] A string to compare.
Returns
tTrue if the two strings are not equal tFalse otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsNumber ( tChar  c)
static

This function checks if a tChar is a number.

Parameters
c[in] Character to be checked.
Returns
Returns true, if the character is a number or false otherwise
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsSymbolChar ( tChar  c)
static

This function checks if a given tChar value is valid to be used in a symbol name.

Parameters
c[in] Character to be checked.
Returns
Returns true, if the character is a whitespace or false otherwise.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tBool IsWhiteChar ( tChar  c)
static

This function checks if a given tChar value is a whitespace character.

Parameters
c[in] Character to be checked.
Returns
Returns true, if the character is a whitespace or false otherwise.
This method is real-time safe.
See The ADTF Real-Time Extension.
cString Left ( tInt  nLength) const

Extracts the first (that is, leftmost) nLength characters from the cString 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 cString object.
Returns
A cString object that contains a copy of the specified range of characters. Note that the returned cString object may be empty.
cString Mid ( tInt  nPos,
tInt  nLength = -1 
) const

This function extracts a substring of length nLength characters from the cString 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 cString object that is to be included in the extracted substring.
nLength[in] The number of characters to extract from this cString object. If this parameter is not supplied, then the remainder of the string is extracted.
Returns
A cString object that contains a copy of the specified range of characters. Note that the returned cString object may be empty.
void NumTrim ( )

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

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

OPT_INLINE operator const tChar * ( ) const

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

No characters are copied; only a pointer is returned. Be careful with this operator. If you change a cString 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.
See The ADTF Real-Time Extension.
tBool operator!= ( const tChar pString) const

Checks if a strings not equals the cString object.

Parameters
pStringThe string.
Returns
True if strings are not equal
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator!= ( const cString strString) const

Checks if a strings not equals the cString object.

Parameters
strStringThe string.
Returns
True if strString is not equal
This method is real-time safe.
See The ADTF Real-Time Extension.
const cString& operator+= ( const cString strString)

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 cString object.

Parameters
strString[in] second cString object to be concatenated.
Returns
Reference to accessed cString object.
tBool operator< ( const tChar pString) const

Checks if a strings is lexicographically greater than the cString object.

Parameters
pStringThe string.
Returns
True if pString is greater
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator< ( const cString strString) const

Checks if a strings is lexicographically greater than the cString object.

Parameters
strStringThe string.
Returns
True if strString is greater
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator<= ( const tChar pString) const

Checks if a strings is lexicographically greater than or equal to the cString object.

Parameters
pStringThe string.
Returns
True if pString is greater or equal
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator<= ( const cString strString) const

Checks if a strings is lexicographically greater than or equal to the cString object.

Parameters
strStringThe string.
Returns
True if strString is greater or equal
This method is real-time safe.
See The ADTF Real-Time Extension.
cString& operator= ( tChar  cChar)

The cString assignment (=) operator reinitializes an existing cString object with new data.

Parameters
cChar[in] character to be assigned.
Returns
Reference to accessed cString object.
cString& operator= ( const tChar pString)

The cString assignment (=) operator reinitializes an existing cString object with new data.

Parameters
pString[in] Null-terminated string value to be assigned.
Returns
Reference to accessed cString object.
cString& operator= ( const cString strString)

The cString assignment (=) operator reinitializes an existing cString object with new data.

Parameters
strString[in] cString object to be assigned.
Returns
Reference to accessed cString object.
tBool operator== ( const tChar pString) const

Checks if a strings equals the cString object.

Parameters
pStringThe string.
Returns
True if strings are equal
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator== ( const cString strString) const

Checks if a strings equals the cString object.

Parameters
strStringThe string.
Returns
True if strString is equal
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator> ( const tChar pString) const

Checks if a strings is lexicographically smaller than the cString object.

Parameters
pStringThe string.
Returns
True if pString is smaller
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator> ( const cString strString) const

Checks if a strings is lexicographically smaller than the cString object.

Parameters
strStringThe string.
Returns
True if strString is smaller
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator>= ( const tChar pString) const

Checks if a strings is lexicographically smaller than or equal to the cString object.

Parameters
pStringThe string.
Returns
True if pString is smaller or equal
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool operator>= ( const cString strString) const

Checks if a strings is lexicographically smaller than or equal to the cString object.

Parameters
strStringThe string.
Returns
True if strString is smaller or equal
This method is real-time safe.
See The ADTF Real-Time Extension.
const tChar& operator[] ( tUInt  nIdx) const

array access operator

Parameters
nIdx[in] Zero-based index of the character in the cString 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
tChar& operator[] ( tUInt  nIdx)

array access operator

Parameters
nIdx[in] Zero-based index of the character in the cString 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
static cString Repeat ( tChar  c,
tInt  nCount 
)
static

This function creates a new cString object by repeating one single character.

If nCount equals zero, an empty string is created.

Parameters
c[in] Character to be repeated.
nCount[in] Number of times the character should be repeated.
Returns
Returns a new cString object, initialized with a repeated character.
tInt Replace ( const cString strOld,
const cString strNew,
tBool  bReplaceAll = true 
)

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.
tInt Replace ( tChar  cOld,
tChar  cNew,
tBool  bReplaceAll = true 
)

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.
See The ADTF Real-Time Extension.
tInt RFind ( const tChar  cChar,
tInt  nStart = -1 
) const

This function searches the cString 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 -1 to start from the end.
Returns
The zero-based index of the last character in this cString object that matches the requested character; -1 if the character is not found.
This method is real-time safe.
See The ADTF Real-Time Extension.
cString Right ( tInt  nLength) const

Extracts the last (that is, rightmost) nLength characters from the cString 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 cString object.
Returns
A cString object that contains a copy of the specified range of characters. Note that the returned cString object may be empty.
static tInt Scan ( const tChar sSource,
const tChar sFormat,
  ... 
)
static

This function reads data from the input string and writes the data into the location(s) given by arguments.

Each argument must be a pointer to a variable of a type that corresponds to a type specifier in format. If copying takes place between strings that overlap, the behavior is undefined.

Use following format types: For tInt use "%d" For tUInt use "%u" For tUInt use "%u" For tFloat / tFloat64 use "%lf" For tFloat32 "%f" For tChar String use i.e "%80s" if you want to read 80 characters.

For 64-Bit-Integer (tTimeStamp, tInt64) conversion use lld (Win32, Linux) lld maps to a long long integer. This may not be typesafe but is portable between Windows and Linux.

Parameters
sSource[in] Source cString object.
sFormat[in] Format of the variables in the Source string.
...[out] variables of types for string Format values in corresponding order
Returns
The function returns the number of fields successfully converted and assigned. The return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned. The return value lower 0 for an error.
Remarks
: For Floating values this method is very imprecise!
See also
cString::Format
OPT_INLINE cString& Set ( const cString strString,
tInt  nLength = -1 
)

Assigns a new value to a cString object.

Parameters
strString[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 set.

Referenced by cStringPiece::CopyToString().

OPT_INLINE cString& Set ( const tChar pString,
tInt  nLength = -1 
)

Assigns a new value to a cString 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 set.
OPT_INLINE cString& Set ( tChar  c,
tInt  nLength = 1 
)

Assigns a new value to a cString object.

Parameters
c[in] Character value to be assigned.
nLength[in] Repeat count of the character to be assigned.
Returns
The function returns the reference to the string set.
void SetAt ( tInt  nIdx,
tChar  c 
)

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

Parameters
nIdx[in] Zero-based index of the character in the cString 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.
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool SetBuffer ( tInt  nLength)

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
nLength[in] Number of characters to allocate memory for.
Returns
If the buffer is allocated, the function returns true. Otherwise, if there is insufficient memory for the allocation request, the function returns false.
void Split ( cStringList List,
tChar  cToken 
) const

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

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

Parameters
List[in,out] Reference to cStringList object that should be filled. The list is cleaned first.
cToken[in] Token to be handled as separator character.
void Split ( cStringList List,
const cString strToken 
) const

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

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

Parameters
List[in,out] Reference to cStringList object that should be filled. The list is cleaned first.
strToken[in] Token string to be handled as separator key.
void SplitToken ( cStringList List,
const cString sTokenList 
) const

Split string using a token list.

This function splits up a single cString 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
List[in,out] Reference to cStringList object that should be filled. The list is cleaned first.
sTokenList[in] Token list to be used as separator characters.
tBool StartsWith ( const cString strString,
const tBool  bNoCase = tFalse 
) const

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

Parameters
strString[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.
void ToLower ( )

This function converts a cString object to a lowercase string.

This method is real-time safe.
See The ADTF Real-Time Extension.
void ToUpper ( )

This function converts a cString object to a uppercase string.

This method is real-time safe.
See The ADTF Real-Time Extension.
void TrimFunc ( tBool  bLeft,
tBool  bRight,
tBool  bNumeric 
)
protected

This function trims the string.

Parameters
bLeft[in] Trim the left side of the string.
bRight[in] Trim the right side of the string.
bNumeric[in] If it is numeric leading zeros are also removed.
static cString UInt64ToStr ( tUInt64  ui64Value)
staticprotected

Convert 64-bit unsigned integer to string.

Parameters
[in]ui64ValueInteger value
Returns
Converted string value
Remarks
This method is needed due to lack of an appropriate system method, which will be available with specification "C++11".
cString& Unescape ( )

Unescape control characters.

Returns
New cString object containing the formatted data.

Friends And Related Function Documentation

cString operator+ ( const cString str1,
const cString str2 
)
friend

The + concatenation operator joins two strings and returns a CString object.

One of the two argument strings must be a cString object. The other can be a character pointer or a character. You should be aware that out-of-memory errors may occur whenever you use the concatenation operator since new storage may be allocated to hold temporary data.

Parameters
str1[in] first cString object to be concatenated.
str2[in] second cString object to be concatenated.
Returns
A cString object that is the temporary result of the concatenation. This return value makes it possible to combine several concatenations in the same expression.
cString operator+ ( const tChar str1,
const cString str2 
)
friend

The + concatenation operator joins two strings and returns a CString object.

One of the two argument strings must be a cString object. The other can be a character pointer or a character. You should be aware that out-of-memory errors may occur whenever you use the concatenation operator since new storage may be allocated to hold temporary data.

Parameters
str1[in] first cString object to be concatenated.
str2[in] second cString object to be concatenated.
Returns
A cString object that is the temporary result of the concatenation. This return value makes it possible to combine several concatenations in the same expression.
cString operator+ ( const cString str1,
const tChar str2 
)
friend

The + concatenation operator joins two strings and returns a CString object.

One of the two argument strings must be a cString object. The other can be a character pointer or a character. You should be aware that out-of-memory errors may occur whenever you use the concatenation operator since new storage may be allocated to hold temporary data.

Parameters
str1[in] first cString object to be concatenated.
str2[in] second cString object to be concatenated.
Returns
A cString object that is the temporary result of the concatenation. This return value makes it possible to combine several concatenations in the same expression.

Member Data Documentation

const std::string::size_type npos
static
Initial value:
=
static_cast<std::string::size_type>(-1)

string position

Definition at line 1824 of file string.h.


Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)