MoSync 3.3
MAUtil::StringData< Tchar > Class Template Reference

A class that holds the actual data used by String. More...

#include <MAUtil/String.h>

Inheritance diagram for MAUtil::StringData< Tchar >:
MAUtil::Vector< Tchar > MAUtil::RefCounted

List of all members.

Public Types

typedef Tchar * iterator
 Defines a typesafe iterator for the template instance.
typedef const Tchar * const_iterator

Public Member Functions

 StringData (const Tchar *text)
 StringData (const Tchar *text, int len)
 StringData (int len)
 StringData (const StringData &other)
virtual ~StringData ()
void add (const Tchar &val)
 Adds an element to the end of the Vector.
void add (const Tchar *ptr, int num)
 Adds several elements to the end of the Vector.
void remove (iterator i)
 Removes the element pointed to by iterator i.
void remove (int index)
 Removes the element at index.
void remove (int index, int number)
 Removes several elements, starting at index.
void insert (int index, Tchart)
 Inserts the element at index, moving all existing elements beginning at 'index' one step forward.
int size () const
 Returns the number of elements.
void resize (int newSize)
 Resizes the Vector to contain size elements.
void reserve (int newCapacity)
 Reserves space in the Vector.
void clear ()
 Clears the Vector, setting its size to 0 but not altering its capacity.
bool empty () const
 Returns true iff the Vector is empty().
int capacity () const
 Returns the Vector's current capacity.
iterator begin ()
 Returns an iterator pointing to the first element of the Vector.
const_iterator begin () const
 Returns an iterator pointing to the first element of the Vector.
iterator end ()
 Returns an iterator pointing beyond the last element of the Vector.
const_iterator end () const
 Returns an iterator pointing beyond the last element of the Vector.
Tchar & operator[] (int index)
 Returns a reference to the element at index. No range-checking is done.
const Tchar & operator[] (int index) const
 Returns a const reference to the element at index. No range-checking is done.
const Tchar * pointer () const
 Returns a const pointer to the Vector's storage array.
Tchar * pointer ()
 Returns a pointer to the Vector's storage array.
void addRef ()
 Increments the reference count by one.
void release ()
 Decrements the reference count by one.
int getRefCount ()
 Returns the current reference count.

Protected Attributes

int mSize
int mCapacity
Tchar * mData

Friends

class BasicString

Detailed Description

template<class Tchar>
class MAUtil::StringData< Tchar >

A class that holds the actual data used by String.

It's a reference counted vector.


Member Typedef Documentation

typedef Tchar * MAUtil::Vector< Tchar >::iterator [inherited]

Defines a typesafe iterator for the template instance.

typedef const Tchar * MAUtil::Vector< Tchar >::const_iterator [inherited]

Constructor & Destructor Documentation

template<class Tchar>
MAUtil::StringData< Tchar >::StringData ( const Tchar *  text)
template<class Tchar>
MAUtil::StringData< Tchar >::StringData ( const Tchar *  text,
int  len 
)
template<class Tchar>
MAUtil::StringData< Tchar >::StringData ( int  len)
template<class Tchar>
MAUtil::StringData< Tchar >::StringData ( const StringData< Tchar > &  other)
template<class Tchar>
virtual MAUtil::StringData< Tchar >::~StringData ( ) [inline, virtual]

Member Function Documentation

void MAUtil::Vector< Tchar >::add ( const Tchar &  val) [inline, inherited]

Adds an element to the end of the Vector.

Parameters:
valThe element to be added.
void MAUtil::Vector< Tchar >::add ( const Tchar *  ptr,
int  num 
) [inline, inherited]

Adds several elements to the end of the Vector.

Parameters:
ptrA pointer to the elements.
numThe number of elements.
void MAUtil::Vector< Tchar >::remove ( iterator  i) [inline, inherited]

Removes the element pointed to by iterator i.

Parameters:
iAn iterator pointing to the element that should be removed.
void MAUtil::Vector< Tchar >::remove ( int  index) [inline, inherited]

Removes the element at index.

Parameters:
indexThe index of the element that should be removed.
void MAUtil::Vector< Tchar >::remove ( int  index,
int  number 
) [inline, inherited]

Removes several elements, starting at index.

Parameters:
indexThe index of the element that should be removed.
numberThe number of elements to remove.
void MAUtil::Vector< Tchar >::insert ( int  index,
Tchar  t 
) [inline, inherited]

Inserts the element at index, moving all existing elements beginning at 'index' one step forward.

Parameters:
indexThe index of the newly inserted element.
tThe element itself.
int MAUtil::Vector< Tchar >::size ( ) const [inline, inherited]

Returns the number of elements.

Returns:
Returns the number of elements currently in the Vector.
See also:
capacity
void MAUtil::Vector< Tchar >::resize ( int  newSize) [inline, inherited]

Resizes the Vector to contain size elements.

Parameters:
newSizeThe desired size of the Vector.
void MAUtil::Vector< Tchar >::reserve ( int  newCapacity) [inline, inherited]

Reserves space in the Vector.

Parameters:
newCapacityThe desired capacity of the Vector.
Note:
If newCapacity is less than the current capacity of the Vector, nothing will happen.
void MAUtil::Vector< Tchar >::clear ( ) [inline, inherited]

Clears the Vector, setting its size to 0 but not altering its capacity.

bool MAUtil::Vector< Tchar >::empty ( ) const [inline, inherited]

Returns true iff the Vector is empty().

int MAUtil::Vector< Tchar >::capacity ( ) const [inline, inherited]

Returns the Vector's current capacity.

See also:
size
iterator MAUtil::Vector< Tchar >::begin ( ) [inline, inherited]

Returns an iterator pointing to the first element of the Vector.

const_iterator MAUtil::Vector< Tchar >::begin ( ) const [inline, inherited]

Returns an iterator pointing to the first element of the Vector.

iterator MAUtil::Vector< Tchar >::end ( ) [inline, inherited]

Returns an iterator pointing beyond the last element of the Vector.

const_iterator MAUtil::Vector< Tchar >::end ( ) const [inline, inherited]

Returns an iterator pointing beyond the last element of the Vector.

Tchar & MAUtil::Vector< Tchar >::operator[] ( int  index) [inline, inherited]

Returns a reference to the element at index. No range-checking is done.

Parameters:
indexThe index of the element to be returned.
const Tchar & MAUtil::Vector< Tchar >::operator[] ( int  index) const [inline, inherited]

Returns a const reference to the element at index. No range-checking is done.

Parameters:
indexThe index of the element to be returned.
const Tchar * MAUtil::Vector< Tchar >::pointer ( ) const [inline, inherited]

Returns a const pointer to the Vector's storage array.

Note:
The pointer becomes invalid when the Vector is changed.
Tchar * MAUtil::Vector< Tchar >::pointer ( ) [inline, inherited]

Returns a pointer to the Vector's storage array.

Note:
The pointer becomes invalid when the Vector is changed.
void MAUtil::RefCounted::addRef ( ) [inherited]

Increments the reference count by one.

void MAUtil::RefCounted::release ( ) [inherited]

Decrements the reference count by one.

int MAUtil::RefCounted::getRefCount ( ) [inherited]

Returns the current reference count.


Friends And Related Function Documentation

template<class Tchar>
friend class BasicString [friend]

Member Data Documentation

int MAUtil::Vector< Tchar >::mSize [protected, inherited]
int MAUtil::Vector< Tchar >::mCapacity [protected, inherited]
Tchar * MAUtil::Vector< Tchar >::mData [protected, inherited]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines