MAUtil::StringData Class Reference

#include <MAUtil/String.h>

Inheritance diagram for MAUtil::StringData:

MAUtil::Vector< char > MAUtil::RefCounted List of all members.

Detailed Description

A class that holds the actual data used by String. It's a reference counted vector.


Public Types

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

Public Member Functions

 StringData (const char *text)
 StringData (const char *text, int len)
 StringData (int size)
 StringData (const StringData &other)
virtual ~StringData ()
void add (const char &val)
 Adds an element to the end of the Vector.
void add (const char *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 insert (int index, chart)
 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.
char & operator[] (int index)
 Returns a reference to the element at index. No range-checking is done.
const char & operator[] (int index) const
 Returns a const reference to the element at index. No range-checking is done.
const char * pointer () const
 Returns a const pointer to the Vector's storage array.
char * 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
char * mData

Friends

class String


Member Typedef Documentation

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

Defines a typesafe iterator for the template instance.

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


Constructor & Destructor Documentation

MAUtil::StringData::StringData const char *  text  ) 
 

MAUtil::StringData::StringData const char *  text,
int  len
 

MAUtil::StringData::StringData int  size  ) 
 

MAUtil::StringData::StringData const StringData other  ) 
 

virtual MAUtil::StringData::~StringData  )  [inline, virtual]
 


Member Function Documentation

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

Adds an element to the end of the Vector.

Parameters:
val The element to be added.

void MAUtil::Vector< char >::add const char *  ptr,
int  num
[inline, inherited]
 

Adds several elements to the end of the Vector.

Parameters:
ptr A pointer to the elements.
num The number of elements.

void MAUtil::Vector< char >::remove iterator  i  )  [inline, inherited]
 

Removes the element pointed to by iterator i.

Parameters:
i An iterator pointing to the element that should be removed.

void MAUtil::Vector< char >::remove int  index  )  [inline, inherited]
 

Removes the element at index.

Parameters:
index The index of the element that should be removed.

void MAUtil::Vector< char >::insert int  index,
char   t
[inline, inherited]
 

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

Parameters:
index The index of the newly inserted element.
t The element itself.

int MAUtil::Vector< char >::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< char >::resize int  newSize  )  [inline, inherited]
 

Resizes the Vector to contain size elements.

Parameters:
newSize The desired size of the Vector.

void MAUtil::Vector< char >::reserve int  newCapacity  )  [inline, inherited]
 

Reserves space in the Vector.

Parameters:
newCapacity The desired capacity of the Vector.
Note:
If newCapacity is less than the current capacity of the Vector, nothing will happen.

void MAUtil::Vector< char >::clear  )  [inline, inherited]
 

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

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

Returns true iff the Vector is empty().

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

Returns the Vector's current capacity.

See also:
size

iterator MAUtil::Vector< char >::begin  )  [inline, inherited]
 

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

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

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

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

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

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

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

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

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

Parameters:
index The index of the element to be returned.

const char & MAUtil::Vector< char >::operator[] int  index  )  const [inline, inherited]
 

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

Parameters:
index The index of the element to be returned.

const char * MAUtil::Vector< char >::pointer  )  const [inline, inherited]
 

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

Note:
The pointer becomes invalid when the Vector is changed.

char * MAUtil::Vector< char >::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

friend class String [friend]
 


Member Data Documentation

int MAUtil::Vector< char >::mSize [protected, inherited]
 

int MAUtil::Vector< char >::mCapacity [protected, inherited]
 

char * MAUtil::Vector< char >::mData [protected, inherited]
 


Generated on Sat Feb 13 00:15:40 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO