fm::stringT< CH > Class Template Reference
[Utility Classes.]

A string template. More...

#include <FUString.h>

Inheritance diagram for fm::stringT< CH >:

fm::vector< CH, true > List of all members.

Public Types

typedef fm::vector< CH, true > Parent
 The parent class.

Public Member Functions

 stringT ()
 Default constructor.
 stringT (const stringT &c)
 Copy constructor.
 stringT (const CH *c)
 Copy constructor.
 stringT (const CH *c, size_t length)
 Copy constructor.
 stringT (size_t length, const CH &c)
 Constructor.
size_t length () const
 Retrieves the length of the string.
size_t size () const
 See above.
CH & back ()
 Retrieves the last element of the string.
const CH & back () const
 See above.
void pop_back ()
 Removes the last character from a string.
bool empty () const
 Retrieves whether the string contains useful data.
stringT substr (size_t start, size_t count=npos) const
 Retrieves a segment of the string.
void append (const stringT &str)
 Appends a string to this string.
void append (const CH *str, size_t count=npos)
 Appends a NULL-terminated character buffer to this string.
void append (const CH &c)
 Appends one character to this string.
void insert (size_t offset, const CH *str, size_t count=npos)
 Inserts a character buffer in this string.
void insert (size_t offset, const stringT &str)
 Inserts a string in this string.
const CH * c_str () const
 Retrieves the character buffer attached to this string.
 operator const CH * () const
 See above.
size_t find (const CH &character, size_t offset=0) const
 Retrieves the position of the first matching character found within the string.
size_t find (const stringT &str, size_t offset=0) const
 Retrieves the position of the first matching string found within the string.
size_t find (const CH *c, size_t offset=0) const
 Retrieves the position of the first matching character buffer found within the string.
size_t rfind (const CH &character, size_t offset=0) const
 Retrieves the position of the last matching character found within the string.
size_t rfind (const stringT &str, size_t offset=0) const
 Retrieves the position of the last matching string found within the string.
size_t rfind (const CH *c, size_t offset=0) const
 Retrieves the position of the last matching character buffer found within the string.
size_t find_first_of (const CH *c, size_t offset=0) const
 Retrieves the position of the first matching character from a list of possible characters.
size_t find_last_of (const CH *c, size_t offset=0) const
 Retrieves the position of the last matching character from a list of possible characters.
void erase (size_t start=0, size_t end=npos)
 Removes a range of characters from a string.
void resize (size_t size)
 Override the fm::vector resize.
void resize (size_t count, const CH &value)
 Override the fm::vector resize.

Static Public Attributes

static const size_t npos = ~(size_t)0
 Constant for infinity length.

Detailed Description

template<class CH>
class fm::stringT< CH >

A string template.

Intentionally has an interface similar to STL. You should use fm::string for UTF8 strings and fstring for UNICODE strings.


Constructor & Destructor Documentation

template<class CH>
fm::stringT< CH >::stringT  )  [inline]
 

Default constructor.

Defaults to an empty string.

template<class CH>
fm::stringT< CH >::stringT const stringT< CH > &  c  )  [inline]
 

Copy constructor.

Parameters:
c The string to clone.

template<class CH>
fm::stringT< CH >::stringT const CH *  c  )  [inline]
 

Copy constructor.

Parameters:
c A NULL-terminated character buffer to clone.

template<class CH>
fm::stringT< CH >::stringT const CH *  c,
size_t  length
[inline]
 

Copy constructor.

Parameters:
c A character buffer to clone.
length A partial length to copy. Use stringT::npos for copying full NULL-terminated strings.

template<class CH>
fm::stringT< CH >::stringT size_t  length,
const CH &  c
[inline]
 

Constructor.

Parameters:
length The number of characters to repeat in the string.
c The character value to repeat within the string.


Member Function Documentation

template<class CH>
void fm::stringT< CH >::append const CH &  c  )  [inline]
 

Appends one character to this string.

Parameters:
c A character.

template<class CH>
void fm::stringT< CH >::append const CH *  str,
size_t  count = npos
[inline]
 

Appends a NULL-terminated character buffer to this string.

Parameters:
str A NULL-terminated character buffer.
count The number of characters to append. If the count is 'npos', all available characters are appended.

template<class CH>
void fm::stringT< CH >::append const stringT< CH > &  str  )  [inline]
 

Appends a string to this string.

Parameters:
str A second string.

template<class CH>
CH& fm::stringT< CH >::back  )  [inline]
 

Retrieves the last element of the string.

This function is NULL-termination aware.

Returns:
The last element of the string.

Reimplemented from fm::vector< CH, true >.

template<class CH>
const CH* fm::stringT< CH >::c_str  )  const [inline]
 

Retrieves the character buffer attached to this string.

Returns:
The NULL-terminated character buffer for this string.

template<class CH>
bool fm::stringT< CH >::empty  )  const [inline]
 

Retrieves whether the string contains useful data.

This function differs from the parent because it checks for NULL-termination.

Returns:
Whether the string contains useful data.

Reimplemented from fm::vector< CH, true >.

template<class CH>
void fm::stringT< CH >::erase size_t  start = 0,
size_t  end = npos
[inline]
 

Removes a range of characters from a string.

Parameters:
start The start of the range of characters to remove. Defaults to zero.
end The end of the range of characters to remove. The character at this position will not be removed so that if (start==end), no operation is done. Defaults to npos, which indicates that all characters from the start of the range should be removed.

Reimplemented from fm::vector< CH, true >.

template<class CH>
size_t fm::stringT< CH >::find const CH *  c,
size_t  offset = 0
const [inline]
 

Retrieves the position of the first matching character buffer found within the string.

Parameters:
c The character buffer to match.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the first matching character buffer. If 'npos' is returned, the character buffer was not matched within the given (sub)string.

template<class CH>
size_t fm::stringT< CH >::find const stringT< CH > &  str,
size_t  offset = 0
const [inline]
 

Retrieves the position of the first matching string found within the string.

Parameters:
str The string to match. If the string is zero-terminated, the null character will not be included in the search.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the first matching string. If 'npos' is returned, the string was not matched within the given (sub)string.

template<class CH>
size_t fm::stringT< CH >::find const CH &  character,
size_t  offset = 0
const [inline]
 

Retrieves the position of the first matching character found within the string.

Parameters:
character The character to match.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the first matching character. If 'npos' is returned, the character was not matched within the given (sub)string.

template<class CH>
size_t fm::stringT< CH >::find_first_of const CH *  c,
size_t  offset = 0
const [inline]
 

Retrieves the position of the first matching character from a list of possible characters.

Parameters:
c A list of possible characters to match.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the first matching character within the list of possible characters. If 'npos' is returned, none of the possible characters were found within the (sub)string.

template<class CH>
size_t fm::stringT< CH >::find_last_of const CH *  c,
size_t  offset = 0
const [inline]
 

Retrieves the position of the last matching character from a list of possible characters.

Parameters:
c A list of possible characters to match.
offset An offset (from the end of the string) at which to start searching. Defaults to zero.
Returns:
The position of the last matching character within the list of possible characters. If 'npos' is returned, none of the possible characters were found within the (sub)string.

template<class CH>
void fm::stringT< CH >::insert size_t  offset,
const stringT< CH > &  str
[inline]
 

Inserts a string in this string.

Parameters:
offset The position at which to insert the string.
str A second string.

template<class CH>
void fm::stringT< CH >::insert size_t  offset,
const CH *  str,
size_t  count = npos
[inline]
 

Inserts a character buffer in this string.

Parameters:
offset The position at which to insert the character buffer.
str A NULL-terminated character buffer.
count The number of characters to append. If the count is 'npos', all available characters are appended.

Reimplemented from fm::vector< CH, true >.

template<class CH>
size_t fm::stringT< CH >::length  )  const [inline]
 

Retrieves the length of the string.

This function is NULL-termination aware.

Returns:
The length of the string.

template<class CH>
void fm::stringT< CH >::pop_back  )  [inline]
 

Removes the last character from a string.

This function is NULL-termination aware.

Reimplemented from fm::vector< CH, true >.

template<class CH>
void fm::stringT< CH >::resize size_t  count,
const CH &  value
[inline]
 

Override the fm::vector resize.

That call does not handle the assumption this class makes that every string is null terminated.

Sets the number of values contained in the list.

Parameters:
count The new number of values contained in the list.
value The value to assign to the new entries in the list.

Reimplemented from fm::vector< CH, true >.

template<class CH>
void fm::stringT< CH >::resize size_t  size  )  [inline]
 

Override the fm::vector resize.

That call does not handle the assumption this class makes that every string is null terminated.

The fm::string resize command will automatically create a null terminated string of length size

Parameters:
size Length of resulting string

Reimplemented from fm::vector< CH, true >.

template<class CH>
size_t fm::stringT< CH >::rfind const CH *  c,
size_t  offset = 0
const [inline]
 

Retrieves the position of the last matching character buffer found within the string.

Parameters:
c The character buffer to match.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the last matching character buffer. If 'npos' is returned, the character buffer was not matched within the given (sub)string.

template<class CH>
size_t fm::stringT< CH >::rfind const stringT< CH > &  str,
size_t  offset = 0
const [inline]
 

Retrieves the position of the last matching string found within the string.

Parameters:
str The string to match. If the string is zero-terminated, the null character will not be included in the search.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the last matching string. If 'npos' is returned, the string was not matched within the given (sub)string.

template<class CH>
size_t fm::stringT< CH >::rfind const CH &  character,
size_t  offset = 0
const [inline]
 

Retrieves the position of the last matching character found within the string.

Parameters:
character The character to match.
offset An offset at which to start searching. Defaults to zero.
Returns:
The position of the last matching character. If 'npos' is returned, the character was not matched within the given (sub)string.

template<class CH>
stringT fm::stringT< CH >::substr size_t  start,
size_t  count = npos
const [inline]
 

Retrieves a segment of the string.

Parameters:
start The index of the first character to extract.
count The number of characters to extract. When the count is 'npos', all the remaining characters are extracted.
Returns:
The partial string.


Member Data Documentation

template<class CH>
const size_t fm::stringT< CH >::npos = ~(size_t)0 [static]
 

Constant for infinity length.

This important constant is used throughout the class to indicate infinity or values not found.


The documentation for this class was generated from the following file:
Generated on Thu Feb 14 16:58:42 2008 for FCollada by  doxygen 1.4.6-NO