ezEngine  Milestone 9
ezStringBase< Derived > Struct Template Reference

Base class for strings, which implements all read-only string functions. More...

#include <StringBase.h>

Inheritance diagram for ezStringBase< Derived >:

Public Types

typedef ezStringIterator< Derived > iterator
 
typedef ezStringIterator< Derived > const_iterator
 
typedef ezStringReverseIterator< Derived > reverse_iterator
 
typedef ezStringReverseIterator< Derived > const_reverse_iterator
 

Public Member Functions

bool IsEmpty () const
 Returns whether the string is an empty string.
 
bool StartsWith (const char *szStartsWith) const
 Returns true, if this string starts with the given string.
 
bool StartsWith_NoCase (const char *szStartsWith) const
 Returns true, if this string starts with the given string. Case insensitive.
 
bool EndsWith (const char *szEndsWith) const
 Returns true, if this string ends with the given string.
 
bool EndsWith_NoCase (const char *szEndsWith) const
 Returns true, if this string ends with the given string. Case insensitive.
 
const char * FindSubString (const char *szStringToFind, const char *szStartSearchAt=nullptr) const
 
const char * FindSubString_NoCase (const char *szStringToFind, const char *szStartSearchAt=nullptr) const
 
const char * FindLastSubString (const char *szStringToFind, const char *szStartSearchAt=nullptr) const
 
const char * FindLastSubString_NoCase (const char *szStringToFind, const char *szStartSearchAt=nullptr) const
 
const char * FindWholeWord (const char *szSearchFor, ezStringUtils::EZ_CHARACTER_FILTER IsDelimiterCB, const char *szStartSearchAt=nullptr) const
 
const char * FindWholeWord_NoCase (const char *szSearchFor, ezStringUtils::EZ_CHARACTER_FILTER IsDelimiterCB, const char *szStartSearchAt=nullptr) const
 
ezInt32 Compare (const char *pString2) const
 Compares this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise.
 
ezInt32 CompareN (const char *pString2, ezUInt32 uiCharsToCompare) const
 
ezInt32 Compare_NoCase (const char *pString2) const
 Compares this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise. Case insensitive.
 
ezInt32 CompareN_NoCase (const char *pString2, ezUInt32 uiCharsToCompare) const
 
bool IsEqual (const char *pString2) const
 Compares this string with the other string for equality.
 
bool IsEqualN (const char *pString2, ezUInt32 uiCharsToCompare) const
 Compares up to a given number of characters of this string with the other string for equality. Case insensitive.
 
bool IsEqual_NoCase (const char *pString2) const
 Compares this string with the other string for equality.
 
bool IsEqualN_NoCase (const char *pString2, ezUInt32 uiCharsToCompare) const
 Compares up to a given number of characters of this string with the other string for equality. Case insensitive.
 
const char * ComputeCharacterPosition (ezUInt32 uiCharacterIndex) const
 Computes the pointer to the n-th character in the string. This is a linear search from the start.
 
iterator GetIteratorFront () const
 Returns an iterator to this string, which points to the very first character. More...
 
reverse_iterator GetIteratorBack () const
 Returns an iterator to this string, which points to the very last character (NOT the end). More...
 

Friends

template<typename T , bool isString>
struct ezInternal::HashHelperImpl
 
struct ezStringIterator< Derived >
 
struct ezStringReverseIterator< Derived >
 
template<typename T >
struct ezCompareHelper
 
struct ezCompareString_NoCase
 
struct ezHashHelperString_NoCase
 
template<typename DerivedLhs , typename DerivedRhs >
bool operator== (const ezStringBase< DerivedLhs > &lhs, const ezStringBase< DerivedRhs > &rhs)
 
template<typename DerivedLhs , typename DerivedRhs >
bool operator!= (const ezStringBase< DerivedLhs > &lhs, const ezStringBase< DerivedRhs > &rhs)
 
template<typename DerivedLhs , typename DerivedRhs >
bool operator< (const ezStringBase< DerivedLhs > &lhs, const ezStringBase< DerivedRhs > &rhs)
 
template<typename DerivedLhs , typename DerivedRhs >
bool operator> (const ezStringBase< DerivedLhs > &lhs, const ezStringBase< DerivedRhs > &rhs)
 
template<typename DerivedLhs , typename DerivedRhs >
bool operator<= (const ezStringBase< DerivedLhs > &lhs, const ezStringBase< DerivedRhs > &rhs)
 
template<typename DerivedLhs , typename DerivedRhs >
bool operator>= (const ezStringBase< DerivedLhs > &lhs, const ezStringBase< DerivedRhs > &rhs)
 

Detailed Description

template<typename Derived>
struct ezStringBase< Derived >

Base class for strings, which implements all read-only string functions.

Member Function Documentation

◆ CompareN()

template<typename Derived >
ezInt32 ezStringBase< Derived >::CompareN ( const char *  pString2,
ezUInt32  uiCharsToCompare 
) const

Compares up to a given number of characters of this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise.

◆ CompareN_NoCase()

template<typename Derived >
ezInt32 ezStringBase< Derived >::CompareN_NoCase ( const char *  pString2,
ezUInt32  uiCharsToCompare 
) const

Compares up to a given number of characters of this string with the other one. Returns 0 for equality, -1 if this string is 'smaller', 1 otherwise. Case insensitive.

◆ FindLastSubString()

template<typename Derived >
const char * ezStringBase< Derived >::FindLastSubString ( const char *  szStringToFind,
const char *  szStartSearchAt = nullptr 
) const
inline

Returns a pointer to the last occurrence of szStringToFind, or nullptr if none was found. szStartSearchAt allows to start searching at the end of the string (if it is nullptr) or at an earlier position.

◆ FindLastSubString_NoCase()

template<typename Derived >
const char * ezStringBase< Derived >::FindLastSubString_NoCase ( const char *  szStringToFind,
const char *  szStartSearchAt = nullptr 
) const
inline

Returns a pointer to the last occurrence of szStringToFind, or nullptr if none was found. Case insensitive. szStartSearchAt allows to start searching at the end of the string (if it is nullptr) or at an earlier position.

◆ FindSubString()

template<typename Derived >
const char * ezStringBase< Derived >::FindSubString ( const char *  szStringToFind,
const char *  szStartSearchAt = nullptr 
) const

Returns a pointer to the first occurrence of szStringToFind, or nullptr if none was found. To find the next occurrence, use an ezStringView which points to the next position and call FindSubString again.

◆ FindSubString_NoCase()

template<typename Derived >
const char * ezStringBase< Derived >::FindSubString_NoCase ( const char *  szStringToFind,
const char *  szStartSearchAt = nullptr 
) const

Returns a pointer to the first occurrence of szStringToFind, or nullptr if none was found. Case insensitive. To find the next occurrence, use an ezStringView which points to the next position and call FindSubString again.

◆ FindWholeWord()

template<typename Derived >
const char * ezStringBase< Derived >::FindWholeWord ( const char *  szSearchFor,
ezStringUtils::EZ_CHARACTER_FILTER  IsDelimiterCB,
const char *  szStartSearchAt = nullptr 
) const
inline

Searches for the word szSearchFor. If IsDelimiterCB returns true for both characters in front and back of the word, the position is returned. Otherwise nullptr.

◆ FindWholeWord_NoCase()

template<typename Derived >
const char * ezStringBase< Derived >::FindWholeWord_NoCase ( const char *  szSearchFor,
ezStringUtils::EZ_CHARACTER_FILTER  IsDelimiterCB,
const char *  szStartSearchAt = nullptr 
) const
inline

Searches for the word szSearchFor. If IsDelimiterCB returns true for both characters in front and back of the word, the position is returned. Otherwise nullptr. Ignores case.

◆ GetIteratorBack()

template<typename Derived >
ezStringBase< Derived >::reverse_iterator ezStringBase< Derived >::GetIteratorBack ( ) const

Returns an iterator to this string, which points to the very last character (NOT the end).

Note that this iterator will only be valid as long as this string lives. Once the original string is destroyed, all iterators to them will point into invalid memory.

◆ GetIteratorFront()

template<typename Derived >
ezStringBase< Derived >::iterator ezStringBase< Derived >::GetIteratorFront ( ) const

Returns an iterator to this string, which points to the very first character.

Note that this iterator will only be valid as long as this string lives. Once the original string is destroyed, all iterators to them will point into invalid memory.


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