FUStringBuilderT< Char > Class Template Reference
[Utility Classes.]

A dynamically-sized string object. More...

#include <FUStringBuilder.h>

List of all members.

Public Types

typedef fm::stringT< Char > String
 The standard string object which correspond to the builder.

Public Member Functions

 FUStringBuilderT (const String &sz)
 Creates a new builder with the content of the given string.
 FUStringBuilderT (const Char *sz)
 Creates a new builder with the content of the given character array.
 FUStringBuilderT (Char ch, size_t count)
 Creates a new builder with the given character repeated multiple times over the array.
 FUStringBuilderT (size_t reserved)
 Creates a new builder with an empty buffer.
 FUStringBuilderT ()
 Creates a new builder with an empty buffer.
 ~FUStringBuilderT ()
 Deletes the builder.
void reserve (size_t length)
 Reserves a given number of character slots.
size_t length ()
 Retrieves the length of the content within the builder.
void clear ()
 Clears the content of the builder.
bool empty () const
 Retrieves whether the builder is empty.
void append (Char c)
 Appends a character to the content of the builder.
void append (const String &sz)
 Appends a string to the content of the builder.
void append (const Char *sz)
 Appends a character array to the content of the builder.
void append (const Char *sz, size_t len)
 Appends a character array to the content of the builder.
void append (const FUStringBuilderT &b)
 Appends the content of a builder to the content of this builder.
void append (int32 i)
 Appends the integer value, after converting it to a string, to the content of the builder.
void append (uint32 i)
 See above.
void append (uint64 i)
 See above.
void appendHex (uint8 i)
 Appends the integer value, after converting it to a fm::string, in hexadecimal, to the content of the builder.
template<class T>
void appendHex (const T &i)
 See above.
void append (int i)
 See above.
void append (unsigned int i)
 See above.
void append (float f)
 Appends the floating-point value, after converting it to a string, to the content of the builder.
void append (double f)
 See above.
void append (const FMVector2 &v)
 Appends a vector to the content of the builder.
void append (const FMVector3 &v)
 See above.
void append (const FMVector4 &v)
 See above.
template<typename TYPE>
FUStringBuilderToperator+= (const TYPE &val)
 Appends a value to the content of the builder.
void appendLine (const Char *sz)
 Appends a character array to the content of the builder.
void remove (int32 start)
 Removes a section of the content of the builder.
void remove (int32 start, int32 end)
 Removes a section of the content of the builder.
void pop_back ()
 Removes the last character of the content of the builder.
template<typename TYPE>
void set (const TYPE &val)
 Sets the content of the builder to a given value.
template<typename TYPE>
FUStringBuilderToperator= (const TYPE &val)
 See above.
String ToString () const
 Converts the content of the builder to a standard string.
const Char * ToCharPtr () const
 Converts the content of the builder to a character array.
 operator const Char * () const
 See above.
int32 index (Char c) const
 Retrieves the index of the first character within the content of the builder that is equivalent to the given character.
int32 rindex (Char c) const
 Retrieves the index of the last character within the content of the builder that is equivalent to the given character.
Char back () const
 Retrieves the last character within the content of the builder.


Detailed Description

template<class Char>
class FUStringBuilderT< Char >

A dynamically-sized string object.

The template has two arguments: the character definition and the sprintf() functor class for float to string conversions.

This class should be used for all the string operations, as it contains a dynamically-resized buffer that is not directly tied to its content's length.


Constructor & Destructor Documentation

template<class Char>
FUStringBuilderT< Char >::FUStringBuilderT const String sz  ) 
 

Creates a new builder with the content of the given string.

Parameters:
sz A string. Its content will be copied within the builder.

template<class Char>
FUStringBuilderT< Char >::FUStringBuilderT const Char *  sz  ) 
 

Creates a new builder with the content of the given character array.

Parameters:
sz A character array. Its content will be copied within the builder. It must terminate with an element containing the 'zero' value.

template<class Char>
FUStringBuilderT< Char >::FUStringBuilderT Char  ch,
size_t  count
 

Creates a new builder with the given character repeated multiple times over the array.

Parameters:
ch A character to repeat.
count The number of times to repeat the given character.

template<class Char>
FUStringBuilderT< Char >::FUStringBuilderT size_t  reserved  ) 
 

Creates a new builder with an empty buffer.

See also:
reserve
Parameters:
reserved The number of character slots to reserve within the empty buffer.

template<class Char>
FUStringBuilderT< Char >::~FUStringBuilderT  ) 
 

Deletes the builder.

Its buffer will be cleared. Any pointers to its data will be dangling.


Member Function Documentation

template<class Char>
void FUStringBuilderT< Char >::append const FMVector2 v  ) 
 

Appends a vector to the content of the builder.

Parameters:
v A vector.

template<class Char>
void FUStringBuilderT< Char >::append float  f  ) 
 

Appends the floating-point value, after converting it to a string, to the content of the builder.

If the floating-point value is the special token that represents infinity, the string "INF" is appended. If it represents the negative infinity, the string "-INF" is appended. If it represents the impossibility, the string "NaN" is appended.

Parameters:
f A floating-point value.

template<class Char>
void FUStringBuilderT< Char >::append int32  i  ) 
 

Appends the integer value, after converting it to a string, to the content of the builder.

Parameters:
i An integer value.

template<class Char>
void FUStringBuilderT< Char >::append const FUStringBuilderT< Char > &  b  ) 
 

Appends the content of a builder to the content of this builder.

Parameters:
b A string builder.

template<class Char>
void FUStringBuilderT< Char >::append const Char *  sz,
size_t  len
 

Appends a character array to the content of the builder.

Parameters:
sz A character array. It should not contain any 'zero' characters before 'len'
len The number of characters to read from sz.

template<class Char>
void FUStringBuilderT< Char >::append const Char *  sz  ) 
 

Appends a character array to the content of the builder.

Parameters:
sz A character array. It must terminate with an element containing the 'zero' value.

template<class Char>
void FUStringBuilderT< Char >::append const String sz  ) 
 

Appends a string to the content of the builder.

Parameters:
sz A string.

template<class Char>
void FUStringBuilderT< Char >::append Char  c  ) 
 

Appends a character to the content of the builder.

Parameters:
c A character. May not be the 'zero' value.

template<class Char>
void FUStringBuilderT< Char >::appendHex uint8  i  ) 
 

Appends the integer value, after converting it to a fm::string, in hexadecimal, to the content of the builder.

The size of the integer will determine the number of characters used.

Parameters:
i An unsigned integer value.

template<class Char>
void FUStringBuilderT< Char >::appendLine const Char *  sz  ) 
 

Appends a character array to the content of the builder.

A newline character will be appended after the character array.

Parameters:
sz A character array. It must terminate with an element containing the 'zero' value.

template<class Char>
Char FUStringBuilderT< Char >::back  )  const [inline]
 

Retrieves the last character within the content of the builder.

Returns:
The last character of the builder.

template<class Char>
void FUStringBuilderT< Char >::clear  ) 
 

Clears the content of the builder.

This does not re-allocate a new buffer.

template<class Char>
bool FUStringBuilderT< Char >::empty  )  const [inline]
 

Retrieves whether the builder is empty.

A builder is considered empty when it has no content, regardless of the size or allocation status of its buffer.

Returns:
Whether the builder is empty.

template<class Char>
int32 FUStringBuilderT< Char >::index Char  c  )  const
 

Retrieves the index of the first character within the content of the builder that is equivalent to the given character.

Parameters:
c The character to match.
Returns:
The index of the first equivalent character. -1 is returned if no character matches the given character.

template<class Char>
size_t FUStringBuilderT< Char >::length  )  [inline]
 

Retrieves the length of the content within the builder.

Returns:
The length of the string.

template<class Char>
template<typename TYPE>
FUStringBuilderT& FUStringBuilderT< Char >::operator+= const TYPE &  val  )  [inline]
 

Appends a value to the content of the builder.

This is a shortcut for the append function.

See also:
append
Parameters:
val A value. This may be numerical, a character, a character array or a string.

template<class Char>
void FUStringBuilderT< Char >::remove int32  start,
int32  end
 

Removes a section of the content of the builder.

The substring defined by the 'start' and 'end' indices will be removed. The 'start' character is removed and is replaced by the 'end' character.

Parameters:
start The index of the first character of the substring to remove.
end The index of the first character after the removed substring.

template<class Char>
void FUStringBuilderT< Char >::remove int32  start  ) 
 

Removes a section of the content of the builder.

Every character that occurs after the given index will be removed, resulting in a shrunk string.

Parameters:
start An index within the content of the builder.

template<class Char>
void FUStringBuilderT< Char >::reserve size_t  length  ) 
 

Reserves a given number of character slots.

If the builder has a buffer with a different number of character slots, a new buffer will be allocated. If the builder has contents, it will be copied within the new buffer. If there is more content than the new buffer can handle, it will be discarded.

Parameters:
length The number of character slots to reserve.

template<class Char>
int32 FUStringBuilderT< Char >::rindex Char  c  )  const
 

Retrieves the index of the last character within the content of the builder that is equivalent to the given character.

Parameters:
c The character to match.
Returns:
The index of the last equivalent character. -1 is returned if no character matches the given character.

template<class Char>
template<typename TYPE>
void FUStringBuilderT< Char >::set const TYPE &  val  )  [inline]
 

Sets the content of the builder to a given value.

This clears the builder of all its content and appends the given value.

Parameters:
val A value. This may be numerical, a character, a character array or a string.

template<class Char>
const Char * FUStringBuilderT< Char >::ToCharPtr  )  const
 

Converts the content of the builder to a character array.

Returns:
A character array with the content of the builder. This pointer is valid for the lifetime of the buffer of the builder, so do not keep it around. This character array should not be modified.

template<class Char>
String FUStringBuilderT< Char >::ToString  )  const
 

Converts the content of the builder to a standard string.

Returns:
A string with the content of the builder.


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