Assimp  v4.1. (December 2018)
irr::core::string< T > Class Template Reference

Very simple string class with some useful features. More...

Public Member Functions

void append (const string< T > &other)
 Appends a string to this string. More...
 
void append (const string< T > &other, s32 length)
 Appends a string of the length l to this string. More...
 
void append (T character)
 Appends a character to this string. More...
 
const T * c_str () const
 Returns character string. More...
 
bool equals_ignore_case (const string< T > &other) const
 Compares the string ignoring case. More...
 
bool equalsn (const string< T > &other, int len)
 compares the first n characters of the strings More...
 
bool equalsn (const T *str, int len)
 compares the first n characters of the strings More...
 
void erase (int index)
 Erases a character from the string. More...
 
s32 findFirst (T c) const
 finds first occurrence of character in string More...
 
s32 findFirstChar (T *c, int count) const
 finds first occurrence of a character of a list in string More...
 
template<class B >
s32 findFirstCharNotInList (B *c, int count) const
 Finds first position of a character not in a given list. More...
 
s32 findLast (T c) const
 finds last occurrence of character in string More...
 
template<class B >
s32 findLastCharNotInList (B *c, int count) const
 Finds last position of a character not in a given list. More...
 
s32 findNext (T c, s32 startPos) const
 finds next occurrence of character in string More...
 
void make_lower ()
 Makes the string lower case. More...
 
void make_upper ()
 Makes the string upper case. More...
 
bool operator!= (const string< T > &other) const
 Equals not operator. More...
 
template<class B >
string< T > operator+ (const B *c)
 Add operator for strings, ascii and unicode. More...
 
string< T > operator+ (const string< T > &other)
 Add operator for other strings. More...
 
void operator+= (const string< T > &other)
 
void operator+= (int i)
 
void operator+= (T c)
 
bool operator< (const string< T > &other) const
 Is smaller operator. More...
 
template<class B >
string< T > & operator= (const B *c)
 Assignment operator for strings, ascii and unicode. More...
 
string< T > & operator= (const string< T > &other)
 Assignment operator. More...
 
bool operator== (const string< T > &other) const
 Comparison operator. More...
 
bool operator== (const T *str) const
 Comparison operator. More...
 
T & operator[] (const s32 index) const
 Direct access operator. More...
 
void replace (T toReplace, T replaceWith)
 replaces all characters of a special type with another one More...
 
void reserve (s32 count)
 Reserves some memory. More...
 
s32 size () const
 Returns length of string. More...
 
 string ()
 Default constructor. More...
 
template<class B >
 string (const B *c)
 Constructor for unicode and ascii strings. More...
 
template<class B >
 string (const B *c, s32 lenght)
 Constructor for copying a string from a pointer with a given lenght. More...
 
 string (const string< T > &other)
 Constructor. More...
 
 string (int number)
 Constructs a string from an int. More...
 
string< T > subString (s32 begin, s32 length)
 Returns a substring. More...
 
void trim ()
 trims the string. More...
 
 ~string ()
 destructor More...
 

Detailed Description

template<class T>
class irr::core::string< T >

Very simple string class with some useful features.

string<c8> and string<wchar_t> work both with unicode AND ascii, so you can assign unicode to string<c8> and ascii to string<wchar_t> (and the other way round) if your ever would want to. Note that the conversation between both is not done using an encoding.

Known bugs: Special characters like 'Ä', 'Ü' and 'Ö' are ignored in the methods make_upper, make_lower and equals_ignore_case.

Constructor & Destructor Documentation

◆ string() [1/5]

template<class T>
irr::core::string< T >::string ( )
inline

Default constructor.

◆ string() [2/5]

template<class T>
irr::core::string< T >::string ( const string< T > &  other)
inline

Constructor.

◆ string() [3/5]

template<class T>
irr::core::string< T >::string ( int  number)
inline

Constructs a string from an int.

◆ string() [4/5]

template<class T>
template<class B >
irr::core::string< T >::string ( const B *  c,
s32  lenght 
)
inline

Constructor for copying a string from a pointer with a given lenght.

◆ string() [5/5]

template<class T>
template<class B >
irr::core::string< T >::string ( const B *  c)
inline

Constructor for unicode and ascii strings.

◆ ~string()

template<class T>
irr::core::string< T >::~string ( )
inline

destructor

Member Function Documentation

◆ append() [1/3]

template<class T>
void irr::core::string< T >::append ( const string< T > &  other)
inline

Appends a string to this string.

Parameters
otherString to append.

◆ append() [2/3]

template<class T>
void irr::core::string< T >::append ( const string< T > &  other,
s32  length 
)
inline

Appends a string of the length l to this string.

Parameters
otherother String to append to this string.
lengthHow much characters of the other string to add to this one.

◆ append() [3/3]

template<class T>
void irr::core::string< T >::append ( character)
inline

Appends a character to this string.

Parameters
characterCharacter to append.

◆ c_str()

template<class T>
const T* irr::core::string< T >::c_str ( ) const
inline

Returns character string.

Returns
Returns pointer to C-style zero terminated string.

◆ equals_ignore_case()

template<class T>
bool irr::core::string< T >::equals_ignore_case ( const string< T > &  other) const
inline

Compares the string ignoring case.

Parameters
otherOther string to compare.
Returns
Returns true if the string are equal ignoring case.

◆ equalsn() [1/2]

template<class T>
bool irr::core::string< T >::equalsn ( const string< T > &  other,
int  len 
)
inline

compares the first n characters of the strings

◆ equalsn() [2/2]

template<class T>
bool irr::core::string< T >::equalsn ( const T *  str,
int  len 
)
inline

compares the first n characters of the strings

◆ erase()

template<class T>
void irr::core::string< T >::erase ( int  index)
inline

Erases a character from the string.

May be slow, because all elements following after the erased element have to be copied.

Parameters
indexIndex of element to be erased.

◆ findFirst()

template<class T>
s32 irr::core::string< T >::findFirst ( c) const
inline

finds first occurrence of character in string

Parameters
cCharacter to search for.
Returns
Returns position where the character has been found, or -1 if not found.

◆ findFirstChar()

template<class T>
s32 irr::core::string< T >::findFirstChar ( T *  c,
int  count 
) const
inline

finds first occurrence of a character of a list in string

Parameters
cList of strings to find. For example if the method should find the first occurance of 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Ususally, this should be strlen(ofParameter1)
Returns
Returns position where one of the character has been found, or -1 if not found.

◆ findFirstCharNotInList()

template<class T>
template<class B >
s32 irr::core::string< T >::findFirstCharNotInList ( B *  c,
int  count 
) const
inline

Finds first position of a character not in a given list.

Parameters
cList of characters not to find. For example if the method should find the first occurance of a character not 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Ususally, this should be strlen(ofParameter1)
Returns
Returns position where the character has been found, or -1 if not found.

◆ findLast()

template<class T>
s32 irr::core::string< T >::findLast ( c) const
inline

finds last occurrence of character in string

Parameters
cCharacter to search for.
Returns
Returns position where the character has been found, or -1 if not found.

◆ findLastCharNotInList()

template<class T>
template<class B >
s32 irr::core::string< T >::findLastCharNotInList ( B *  c,
int  count 
) const
inline

Finds last position of a character not in a given list.

Parameters
cList of characters not to find. For example if the method should find the first occurance of a character not 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Ususally, this should be strlen(ofParameter1)
Returns
Returns position where the character has been found, or -1 if not found.

◆ findNext()

template<class T>
s32 irr::core::string< T >::findNext ( c,
s32  startPos 
) const
inline

finds next occurrence of character in string

Parameters
cCharacter to search for.
startPosPosition in string to start searching.
Returns
Returns position where the character has been found, or -1 if not found.

◆ make_lower()

template<class T>
void irr::core::string< T >::make_lower ( )
inline

Makes the string lower case.

◆ make_upper()

template<class T>
void irr::core::string< T >::make_upper ( )
inline

Makes the string upper case.

◆ operator!=()

template<class T>
bool irr::core::string< T >::operator!= ( const string< T > &  other) const
inline

Equals not operator.

◆ operator+() [1/2]

template<class T>
template<class B >
string<T> irr::core::string< T >::operator+ ( const B *  c)
inline

Add operator for strings, ascii and unicode.

◆ operator+() [2/2]

template<class T>
string<T> irr::core::string< T >::operator+ ( const string< T > &  other)
inline

Add operator for other strings.

◆ operator+=() [1/3]

template<class T>
void irr::core::string< T >::operator+= ( const string< T > &  other)
inline

◆ operator+=() [2/3]

template<class T>
void irr::core::string< T >::operator+= ( int  i)
inline

◆ operator+=() [3/3]

template<class T>
void irr::core::string< T >::operator+= ( c)
inline

◆ operator<()

template<class T>
bool irr::core::string< T >::operator< ( const string< T > &  other) const
inline

Is smaller operator.

◆ operator=() [1/2]

template<class T>
template<class B >
string<T>& irr::core::string< T >::operator= ( const B *  c)
inline

Assignment operator for strings, ascii and unicode.

◆ operator=() [2/2]

template<class T>
string<T>& irr::core::string< T >::operator= ( const string< T > &  other)
inline

Assignment operator.

◆ operator==() [1/2]

template<class T>
bool irr::core::string< T >::operator== ( const string< T > &  other) const
inline

Comparison operator.

◆ operator==() [2/2]

template<class T>
bool irr::core::string< T >::operator== ( const T *  str) const
inline

Comparison operator.

◆ operator[]()

template<class T>
T& irr::core::string< T >::operator[] ( const s32  index) const
inline

Direct access operator.

◆ replace()

template<class T>
void irr::core::string< T >::replace ( toReplace,
replaceWith 
)
inline

replaces all characters of a special type with another one

◆ reserve()

template<class T>
void irr::core::string< T >::reserve ( s32  count)
inline

Reserves some memory.

Parameters
countAmount of characters to reserve.

◆ size()

template<class T>
s32 irr::core::string< T >::size ( ) const
inline

Returns length of string.

Returns
Returns length of the string in characters.

◆ subString()

template<class T>
string<T> irr::core::string< T >::subString ( s32  begin,
s32  length 
)
inline

Returns a substring.

Parameters
beginStart of substring.
lengthLength of substring.

◆ trim()

template<class T>
void irr::core::string< T >::trim ( )
inline

trims the string.

Removes whitespace from begin and end of the string.


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