Public Member Functions | Static Public Member Functions

sp::io::string< T > Class Template Reference

Basic string class. This class wraps the std::string to have better string access. More...

#include <spInputOutputString.hpp>

List of all members.

Public Member Functions

 string ()
 string (const string< T > &Str)
 string (const std::basic_string< T > &Str)
 string (const std::stringstream &Str)
template<typename B >
 string (const B Value)
 ~string ()
string< T > & operator= (const string< T > &Str)
bool operator== (const string< T > &Str) const
bool operator!= (const string< T > &Str) const
string< T > operator+ (const string< T > &Str) const
string< T > & operator+= (const string< T > &Str)
T & operator[] (u32 Index)
const T & operator[] (u32 Index) const
std::basic_string< T > & str ()
 Returns a reference to the internal std::string object.
const std::basic_string< T > & str () const
 Returns the internal std::string object.
const T * c_str () const
 Returns the null terminated ANSI C string.
u32 size () const
 Returns the string length. This is a synonym for the "length" function.
u32 length () const
 Returns the string length.
void resize (u32 Size)
void clear ()
bool empty () const
template<typename B >
val () const
string< T > left (u32 Len) const
string< T > right (u32 Len) const
string< T > mid (u32 Pos, u32 Len) const
string< T > section (u32 Pos1, u32 Pos2) const
string< T > trim () const
 Returns this string without any blanks or tabulators.
string< T > ltrim () const
 Trims only the left side.
string< T > rtrim () const
 Trims only the right side.
bool leftEqual (const string< T > &Str, u32 Len) const
 Returns true if the first 'Len' characters of this string and the given string are equal.
bool rightEqual (const string< T > &Str, u32 Len) const
 Returns true if the last 'Len' characters of this string and the given string are equal.
u32 getLeftEquality (const string< T > &Str) const
 Returns the count of the first equal characters between this string and the given string.
u32 getRightEquality (const string< T > &Str) const
 Returns the count of the last equal characters between this string and the given string.
s32 find (const string< T > &Str, u32 PosBegin=0) const
s32 rfind (const string< T > &Str, u32 PosBegin=-1) const
s32 findChar (const T &SearchChar, u32 PosBegin=0) const
s32 rfindChar (const T &SearchChar, u32 PosBegin=-1) const
s32 findNot (const string< T > &Str, u32 PosBegin=0) const
s32 findNotSpaces (u32 PosBegin=0) const
string< T > & makeUpper ()
 Changes this string to upper case.
string< T > & makeLower ()
 Changes this string to lower case.
string< T > upper () const
 Returns the string with upper case only.
string< T > lower () const
 Returns the string with lower case only.
string< T > replace (const string< T > &StrFind, const string< T > &StrReplace, u32 PosBegin=0) const
string< T > getPathPart () const
 Returns the path part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "C:/Users/Lukas/Documents/").
string< T > getExtensionPart () const
 Returns the extension part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "txt").
string< T > getFilePart () const
 Returns the file part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "Test.txt").
string< T > getStrictFilePart () const
string< T > getRelativePath (string< T > RootPath) const
void adjustPath ()
string< c8toAscii () const
string< c16toUnicode () const

Static Public Member Functions

static T getUpperChar (T AscChar)
static T getLowerChar (T AscChar)
static string< T > ascii (u8 Character)
static string< T > space (u32 Count, c8 Ascii= ' ')
static string< T > create (const string< T > &Str, u32 Count=1)
static string< T > number (u32 Number, u32 DigitsCount, const c8 Ascii= '0')
static string< T > numberFloat (f32 Number, u32 DecimalPlaces, bool isFillBlanks=false)
static string< T > numberSeperators (const string< T > &Str, const c8 Sep= ',')

Detailed Description

template<typename T>
class sp::io::string< T >

Basic string class. This class wraps the std::string to have better string access.


Constructor & Destructor Documentation

template<typename T>
sp::io::string< T >::string (  )  [inline]
template<typename T>
sp::io::string< T >::string ( const string< T > &  Str  )  [inline]
template<typename T>
sp::io::string< T >::string ( const std::basic_string< T > &  Str  )  [inline]
template<typename T>
sp::io::string< T >::string ( const std::stringstream &  Str  )  [inline]
template<typename T>
template<typename B >
sp::io::string< T >::string ( const B  Value  )  [inline]
template<typename T>
sp::io::string< T >::~string (  )  [inline]

Member Function Documentation

template<typename T>
void sp::io::string< T >::adjustPath (  )  [inline]

Removes each redundant "./" strings out of the path string but keeps each "../". The string needs to be a valid path (or rather directory name) or filename.

template<typename T>
static string<T> sp::io::string< T >::ascii ( u8  Character  )  [inline, static]
template<typename T>
const T* sp::io::string< T >::c_str (  )  const [inline]

Returns the null terminated ANSI C string.

template<typename T>
void sp::io::string< T >::clear (  )  [inline]
template<typename T>
static string<T> sp::io::string< T >::create ( const string< T > &  Str,
u32  Count = 1 
) [inline, static]
template<typename T>
bool sp::io::string< T >::empty (  )  const [inline]
template<typename T>
s32 sp::io::string< T >::find ( const string< T > &  Str,
u32  PosBegin = 0 
) const [inline]

Returns the position in the string (beginngin with 0) where the searched string has been found. If the string could not be found the return value is -1.

Parameters:
Str,: Searched string.
PosBegin,: Position where the search shall begin.
template<typename T>
s32 sp::io::string< T >::findChar ( const T &  SearchChar,
u32  PosBegin = 0 
) const [inline]
template<typename T>
s32 sp::io::string< T >::findNot ( const string< T > &  Str,
u32  PosBegin = 0 
) const [inline]

Returns the position in the string (beginning with 0) where any other charaters has been found which are not named in the given string.

Parameters:
Str,: String with all characters which are not wanted.
PosBegin,: Position where the search shall begin.
template<typename T>
s32 sp::io::string< T >::findNotSpaces ( u32  PosBegin = 0  )  const [inline]

Similiar to the "findNot" function but this one accepts each character besides spaces (' ' and '').

Parameters:
PosBegin,: Position where the search shall begin.
template<typename T>
string<T> sp::io::string< T >::getExtensionPart (  )  const [inline]

Returns the extension part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "txt").

template<typename T>
string<T> sp::io::string< T >::getFilePart (  )  const [inline]

Returns the file part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "Test.txt").

template<typename T>
u32 sp::io::string< T >::getLeftEquality ( const string< T > &  Str  )  const [inline]

Returns the count of the first equal characters between this string and the given string.

template<typename T>
static T sp::io::string< T >::getLowerChar ( AscChar  )  [inline, static]
template<typename T>
string<T> sp::io::string< T >::getPathPart (  )  const [inline]

Returns the path part of the string (e.g. "C:/Users/Lukas/Documents/Test.txt" -> "C:/Users/Lukas/Documents/").

template<typename T>
string<T> sp::io::string< T >::getRelativePath ( string< T >  RootPath  )  const [inline]

Returns this string as a relative path in dependency to the given root path.

        io::stringc AbsolutePath = "C:/Users/TestUser/Documents/TestFile.txt";
        
        // 'RelativePath' will contain "../Documents/TestFile.txt".
        io::stringc RelativePath = AbsolutePath.getRelativePath("C:/Users/TestUser/TestFolder/");
template<typename T>
u32 sp::io::string< T >::getRightEquality ( const string< T > &  Str  )  const [inline]

Returns the count of the last equal characters between this string and the given string.

template<typename T>
string<T> sp::io::string< T >::getStrictFilePart (  )  const [inline]
template<typename T>
static T sp::io::string< T >::getUpperChar ( AscChar  )  [inline, static]
template<typename T>
string<T> sp::io::string< T >::left ( u32  Len  )  const [inline]
template<typename T>
bool sp::io::string< T >::leftEqual ( const string< T > &  Str,
u32  Len 
) const [inline]

Returns true if the first 'Len' characters of this string and the given string are equal.

template<typename T>
u32 sp::io::string< T >::length (  )  const [inline]

Returns the string length.

template<typename T>
string<T> sp::io::string< T >::lower (  )  const [inline]

Returns the string with lower case only.

template<typename T>
string<T> sp::io::string< T >::ltrim (  )  const [inline]

Trims only the left side.

template<typename T>
string<T>& sp::io::string< T >::makeLower (  )  [inline]

Changes this string to lower case.

template<typename T>
string<T>& sp::io::string< T >::makeUpper (  )  [inline]

Changes this string to upper case.

template<typename T>
string<T> sp::io::string< T >::mid ( u32  Pos,
u32  Len 
) const [inline]
template<typename T>
static string<T> sp::io::string< T >::number ( u32  Number,
u32  DigitsCount,
const c8  Ascii = '0' 
) [inline, static]

Creates a string out of the given number.

        io::stringc::number( 5, 3); // This returns "005"
        io::stringc::number(16, 3); // This returns "016"
template<typename T>
static string<T> sp::io::string< T >::numberFloat ( f32  Number,
u32  DecimalPlaces,
bool  isFillBlanks = false 
) [inline, static]

Creates a string out of the given floating point number.

Parameters:
[in] Number Specifies the floating point number which is to be converted to a string.
[in] DecimalPlaces Specifies the number of digits after the dot.
[in] isFillBlanks Specifies whether the missing digits after the dot are to be filled with nulls.

        io::stringc::numberFloat(34.1678, 0); // This returns "34"
        io::stringc::numberFloat(34.1678, 1); // This returns "34.1"
        io::stringc::numberFloat(34.1678, 2); // This returns "34.16"
        io::stringc::numberFloat(34.16, 4, true); // This returns "34.1600"
template<typename T>
static string<T> sp::io::string< T >::numberSeperators ( const string< T > &  Str,
const c8  Sep = ',' 
) [inline, static]

Converts the given string (which should only contain numbers) into a string with decimal place seperators.

Parameters:
[in] Str Specifies the string which is to be modified.
[in] Sep Specifies the seperator character. By defautl ','.
Returns:
The new modified string.
        io::stringc::numberSeperators("12345"); // This returns "12,345"
        io::stringc::numberSeperators("1234567", '.'); // This returns "1.234.567"
template<typename T>
bool sp::io::string< T >::operator!= ( const string< T > &  Str  )  const [inline]
template<typename T>
string<T> sp::io::string< T >::operator+ ( const string< T > &  Str  )  const [inline]
template<typename T>
string<T>& sp::io::string< T >::operator+= ( const string< T > &  Str  )  [inline]
template<typename T>
string<T>& sp::io::string< T >::operator= ( const string< T > &  Str  )  [inline]
template<typename T>
bool sp::io::string< T >::operator== ( const string< T > &  Str  )  const [inline]
template<typename T>
T& sp::io::string< T >::operator[] ( u32  Index  )  [inline]
template<typename T>
const T& sp::io::string< T >::operator[] ( u32  Index  )  const [inline]
template<typename T>
string<T> sp::io::string< T >::replace ( const string< T > &  StrFind,
const string< T > &  StrReplace,
u32  PosBegin = 0 
) const [inline]
template<typename T>
void sp::io::string< T >::resize ( u32  Size  )  [inline]
template<typename T>
s32 sp::io::string< T >::rfind ( const string< T > &  Str,
u32  PosBegin = -1 
) const [inline]
template<typename T>
s32 sp::io::string< T >::rfindChar ( const T &  SearchChar,
u32  PosBegin = -1 
) const [inline]
template<typename T>
string<T> sp::io::string< T >::right ( u32  Len  )  const [inline]
template<typename T>
bool sp::io::string< T >::rightEqual ( const string< T > &  Str,
u32  Len 
) const [inline]

Returns true if the last 'Len' characters of this string and the given string are equal.

template<typename T>
string<T> sp::io::string< T >::rtrim (  )  const [inline]

Trims only the right side.

template<typename T>
string<T> sp::io::string< T >::section ( u32  Pos1,
u32  Pos2 
) const [inline]
template<typename T>
u32 sp::io::string< T >::size (  )  const [inline]

Returns the string length. This is a synonym for the "length" function.

template<typename T>
static string<T> sp::io::string< T >::space ( u32  Count,
c8  Ascii = ' ' 
) [inline, static]
template<typename T>
const std::basic_string<T>& sp::io::string< T >::str (  )  const [inline]

Returns the internal std::string object.

template<typename T>
std::basic_string<T>& sp::io::string< T >::str (  )  [inline]

Returns a reference to the internal std::string object.

template<typename T>
string<c8> sp::io::string< T >::toAscii (  )  const [inline]
template<typename T>
string<c16> sp::io::string< T >::toUnicode (  )  const [inline]
template<typename T>
string<T> sp::io::string< T >::trim (  )  const [inline]

Returns this string without any blanks or tabulators.

template<typename T>
string<T> sp::io::string< T >::upper (  )  const [inline]

Returns the string with upper case only.

template<typename T>
template<typename B >
B sp::io::string< T >::val (  )  const [inline]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines