Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmString< RmCharType > Class Template Reference

Templated String class. More...

#include <RmString.h>

List of all members.

Public Member Functions

 RmString ()
 Constructor.

 RmString (const RmString< RmCharType > &src)
 Creates a new string as a copy of the input string:.

 RmString (const RmCharType *srcStr)
 Creates a new string as a copy of the input character string:.

 RmString (const RM_INT32 reserveSize)
 Creates a new empty input string of the specified size:.

 ~RmString ()
 Destructor.

RM_INT32 GetLength () const
RM_INT32 GetBufferSize () const
const RmCharType * GetBuffer () const
void Reserve (const RM_INT32 reserveSize)
void Clear ()
RM_INT32 Compare (const RmString< RmCharType > &src, bool bCaseSensitive=true) const
RM_INT32 Compare (const RmCharType *srcStr, bool bCaseSensitive=true) const
RM_INT32 Find (const RmString< RmCharType > &src, const RM_INT32 startIndex=0, bool bCaseSensitive=true) const
RM_INT32 Find (const RmCharType *srcStr, const RM_INT32 startIndex=0, bool bCaseSensitive=true) const
RM_INT32 Find (const RmCharType Char, const RM_INT32 startIndex=0, bool bCaseSensitive=true) const
RM_INT32 FindOneOf (const RmString< RmCharType > &src, const RM_INT32 startIndex=0, bool bCaseSensitive=true) const
RM_INT32 FindOneOf (const RmCharType *srcStr, const RM_INT32 startIndex=0, bool bCaseSensitive=true) const
RM_INT32 FindFromEnd (const RmString< RmCharType > &src, const RM_INT32 startIndex=-1, bool bCaseSensitive=true) const
RM_INT32 FindFromEnd (const RmCharType *srcStr, const RM_INT32 startIndex=-1, bool bCaseSensitive=true) const
RM_INT32 FindFromEnd (const RmCharType Char, const RM_INT32 startIndex=-1, bool bCaseSensitive=true) const
RM_INT32 FindOneOfFromEnd (const RmString< RmCharType > &src, const RM_INT32 startIndex=-1, bool bCaseSensitive=true) const
RM_INT32 FindOneOfFromEnd (const RmCharType *srcStr, const RM_INT32 startIndex=-1, bool bCaseSensitive=true) const
RM_INT32 FindWholeWord (const RmCharType *srcStr, const RM_INT32 startIndex=0, bool bCaseSensitive=true) const
void RemoveBefore (const RM_INT32 nIndex)
 RemoveBefore will remove all characters before nIndex.

void RemoveAfter (const RM_INT32 nIndex)
 RemoveAfter will remove all characters after nIndex.

void Insert (const RM_INT32 destIndex, const RmString< RmCharType > &src, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
void Insert (const RM_INT32 destIndex, const RmCharType *srcStr, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
void Insert (const RM_INT32 destIndex, const RmCharType Char)
void Copy (const RmString< RmCharType > &src, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
 
  • srcStrtIndex and numChars specifies substring from src string


void Copy (const RmCharType *srcStr, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
 
  • srcStrtIndex and numChars specifies substring from src string


void Append (const RmString< RmCharType > &src, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
 Append String.

void Append (const RmCharType *srcStr, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
 Append String.

void Append (const RmCharType srcChar)
 Append String.

void Prepend (const RmString< RmCharType > &src, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
 Prepend String.

void Prepend (const RmCharType *srcStr, const RM_INT32 srcStartIndex=0, const RM_INT32 numChars=0)
 Prepend String.

void Prepend (const RmCharType srcChar)
 Prepend String.

void Replace (const RmCharType *origStr, const RmCharType *newStr, const RM_INT32 beginScanIndex=0, const RM_INT32 endScanIndex=0, bool bCaseSensitive=true, bool bWholeWord=false)
 Replace.

void ToUpper ()
void ToLower ()
void Format (const RmCharType *szFormat,...)
 C Style Formatting.

void AppendFormat (const RmCharType *szFormat,...)
 C Style Formatting.

RmString< RmCharType > GetDirectoryName () const
 If string is "mydir1\mydir2\myfile.txt",.

RmString< RmCharType > GetFileName (const bool bWithExtension=true) const
RmString< RmCharType > GetExtensionName () const
RmLinkedList< RmString< RmCharType > > GetEachDirectories (const bool bIncludeLast) const
RmCharType & operator[] (const RM_INT32 nIndex)
const RmCharType & operator[] (const RM_INT32 nIndex) const
void operator= (const RmString< RmCharType > &src)
 Comparison operators.

void operator= (const RmCharType *srcStr)
bool operator== (const RmString< RmCharType > &src) const
bool operator== (const RmCharType *srcStr) const
bool operator!= (const RmString< RmCharType > &src) const
bool operator!= (const RmCharType *srcStr) const
RmString< RmCharType > operator+ (const RmString< RmCharType > &src) const
RmString< RmCharType > operator+ (const RmCharType *srcStr) const
RmString< RmCharType > operator+ (const RmCharType srcChar) const
void operator+= (const RmString< RmCharType > &src)
void operator+= (const RmCharType *srcStr)
void operator+= (const RmCharType srcChar)
 operator const RmCharType * () const
 Implicit Cast to const RM_TCHAR*.


Detailed Description

template<class RmCharType>
class RmString< RmCharType >

Templated String class.

Templated string class. Use RmStringA for ASCII string Use RmStringW for Unicode string


Member Function Documentation

template<class RmCharType>
void RmString< RmCharType >::AppendFormat const RmCharType *  szFormat,
... 
 

C Style Formatting.

Eg. If mystr is "hi " and myStr.AppendFormat("my number %d", 10) will produce "hi my number is 10".

template<class RmCharType>
void RmString< RmCharType >::Clear  ) 
 

Clear memory associated with this string:

Returns:
None

template<class RmCharType>
RM_INT32 RmString< RmCharType >::Compare const RmCharType *  srcStr,
bool  bCaseSensitive = true
const
 

Compare two input strings. Returns value < 0 if source string 'src' is less than this string, returns 0 if the strings are identical, and returns > 0 if 'src' is greater than this string

Parameters:
src Source string to compare
bCaseSensitive If true, comparison is case sensitive
Returns:
-1 if source string is less than this string 0 if they are equal 1 if source string is bigger

template<class RmCharType>
RM_INT32 RmString< RmCharType >::Compare const RmString< RmCharType > &  src,
bool  bCaseSensitive = true
const
 

Compare two input strings. Returns value < 0 if source string 'src' is less than this string, returns 0 if the strings are identical, and returns > 0 if 'src' is greater than this string

Parameters:
src Source string to compare
bCaseSensitive If true, comparison is case sensitive
Returns:
-1 if source string is less than this string 0 if they are equal 1 if source string is bigger

template<class RmCharType>
RM_INT32 RmString< RmCharType >::Find const RmCharType  Char,
const RM_INT32  startIndex = 0,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
Char Source character
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::Find const RmCharType *  srcStr,
const RM_INT32  startIndex = 0,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
srcStr Source string
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::Find const RmString< RmCharType > &  src,
const RM_INT32  startIndex = 0,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
src Source string
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindFromEnd const RmCharType  Char,
const RM_INT32  startIndex = -1,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
src Source character
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindFromEnd const RmCharType *  srcStr,
const RM_INT32  startIndex = -1,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
src Source character
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindFromEnd const RmString< RmCharType > &  src,
const RM_INT32  startIndex = -1,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
src Source character
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindOneOf const RmCharType *  srcStr,
const RM_INT32  startIndex = 0,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
src Source character
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindOneOf const RmString< RmCharType > &  src,
const RM_INT32  startIndex = 0,
bool  bCaseSensitive = true
const
 

Search methods. Return the index of the character found in the string and -1 if the input string or character are not found in the queried string.

'startIndex' specifies the index where to begin search from, if that value is -1, then the search starts from the default location. Default search starts at 0th character, except for 'FindFromEnd' method. For FindFromEnd the default search location is at the end of string

Parameters:
src Source character
startIndex Location of comparison starts
bCaseSensitive If true, comparison is case sensitive
Returns:
Location of search result. -1 if not found

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindOneOfFromEnd const RmCharType *  srcStr,
const RM_INT32  startIndex = -1,
bool  bCaseSensitive = true
const
 

Search for one of the characters found in the string 'src' in this string instance. Returns the index of the first found occurence of the input string or -1 if none were foun.

  • Eg. If src string is "abcd", then it returns the found location as soon as one of 'a' or 'b' or 'c' or 'd' is found.

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindOneOfFromEnd const RmString< RmCharType > &  src,
const RM_INT32  startIndex = -1,
bool  bCaseSensitive = true
const
 

Search for one of the characters found in the string 'src' in this string instance. Returns the index of the first found occurence of the input string or -1 if none were foun.

  • Eg. If src string is "abcd", then it returns the found location as soon as one of 'a' or 'b' or 'c' or 'd' is found.

template<class RmCharType>
RM_INT32 RmString< RmCharType >::FindWholeWord const RmCharType *  srcStr,
const RM_INT32  startIndex = 0,
bool  bCaseSensitive = true
const
 

Search for whole word in this string. Returns -1 if the word is not found. If the word is found, returns the index of first found character of that word.

  • Eg. If srcSr is "abc", then it will search for a word "abc" ( separated by space or special characters ) So "abcd" or "zabc" will not be found by this function.

template<class RmCharType>
void RmString< RmCharType >::Format const RmCharType *  szFormat,
... 
 

C Style Formatting.

Eg. If mystr is "hi " and myStr.AppendFormat("my number %d", 10) will produce "hi my number is 10".

template<class RmCharType>
const RmCharType* RmString< RmCharType >::GetBuffer  )  const [inline]
 

Retrieves a pointer to the character buffer for this string

Returns:
Buffer allocated by string

template<class RmCharType>
RM_INT32 RmString< RmCharType >::GetBufferSize  )  const [inline]
 

Retrieves string buffer size

Size of buffer ( number of characters )

template<class RmCharType>
RmString<RmCharType> RmString< RmCharType >::GetDirectoryName  )  const
 

If string is "mydir1\mydir2\myfile.txt",.

GetDirectoryName will return "mydir" GetFileName will return "myfile.txt" GetExtensionName will return "txt" GetEachDirectories will return list of each directories "mydir1", "mydir2"

template<class RmCharType>
RM_INT32 RmString< RmCharType >::GetLength  )  const [inline]
 

Retrieves string length

Returns:
Length of string ( number of characters )

template<class RmCharType>
void RmString< RmCharType >::Insert const RM_INT32  destIndex,
const RmCharType  Char
 

Eg - If destination string is "blahblah" and src is "hello world" and destIndex = 1, srcStartIndex = 2 and numChars = 3, then "llo" is inserted into "b lahblah" ^ |------ here

template<class RmCharType>
void RmString< RmCharType >::Insert const RM_INT32  destIndex,
const RmCharType *  srcStr,
const RM_INT32  srcStartIndex = 0,
const RM_INT32  numChars = 0
 

Eg - If destination string is "blahblah" and src is "hello world" and destIndex = 1, srcStartIndex = 2 and numChars = 3, then "llo" is inserted into "b lahblah" ^ |------ here

template<class RmCharType>
void RmString< RmCharType >::Insert const RM_INT32  destIndex,
const RmString< RmCharType > &  src,
const RM_INT32  srcStartIndex = 0,
const RM_INT32  numChars = 0
 

Eg - If destination string is "blahblah" and src is "hello world" and destIndex = 1, srcStartIndex = 2 and numChars = 3, then "llo" is inserted into "b lahblah" ^ |------ here

template<class RmCharType>
RmString< RmCharType >::operator const RmCharType *  )  const [inline]
 

Implicit Cast to const RM_TCHAR*.

  • So this class can be passed to any function that accepts, const char/wchar *

template<class RmCharType>
RmString<RmCharType> RmString< RmCharType >::operator+ const RmString< RmCharType > &  src  )  const
 

Additive operator Add srcStr to this string and returns result

template<class RmCharType>
void RmString< RmCharType >::operator+= const RmString< RmCharType > &  src  ) 
 

Appending operator Add srcStr to this string

template<class RmCharType>
void RmString< RmCharType >::Reserve const RM_INT32  reserveSize  ) 
 

Reserves memory for a string with the 'reserveSize' size

Parameters:
reserveSize Number of characters to reserve memory for
Returns:
None


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 16:09:25 2005 for RenderMonkey SDK by doxygen 1.3.6