Main Page   Class Hierarchy   Compound List   File List   Compound Members  

DOMString Class Reference

List of all members.

Functions to get properties of the string.

XMLCh charAt (unsigned int index) const
const XMLCh * rawBuffer () const
char * transcode () const
DOMString substringData (unsigned int offset, unsigned int count) const
unsigned int length () const
DOMString transcode (const char *str)

Public Methods

Constructors and assignment operator
 DOMString ()
 DOMString (const DOMString &other)
 DOMString (const XMLCh *other)
 DOMString (const XMLCh *other, unsigned int length)
 DOMString (const char *other)
 DOMString (int nullPointerValue)
DOMString & operator= (const DOMString &other)
DOMString & operator= (DOM_NullPtr *other)
Destructor.
 ~DOMString ()
Equality and Inequality operators.
bool operator== (const DOMString &other) const
bool operator!= (const DOMString &other) const
bool operator== (const DOM_NullPtr *other) const
bool operator!= (const DOM_NullPtr *other) const
Functions to change the string.
void reserve (unsigned int size)
void appendData (const DOMString &other)
void appendData (XMLCh ch)
void appendData (const XMLCh *other)
DOMString & operator+= (const DOMString &other)
DOMString & operator+= (const XMLCh *other)
DOMString & operator+= (XMLCh ch)
void deleteData (unsigned int offset, unsigned int count)
void insertData (unsigned int offset, const DOMString &data)
Cloning function.
DOMString clone () const
Print functions.
void print () const
void println () const
Functions to compare a string with another.
int compareString (const DOMString &other) const
bool equals (const DOMString &other) const
bool equals (const XMLCh *other) const

Friends

class DOMStringData
class DOMStringHandle
class DomMemDebug

Detailed Description

DOMString is the generic string class that stores all strings used in the DOM C++ API.

Though this class supports most of the common string operations to manipulate strings, it is not meant to be a comphrehensive string class.


Constructor & Destructor Documentation

DOMString::DOMString  
 

Default constructor for DOMString. The resulting DOMString object refers to no string at all; it will compare == 0.

DOMString::DOMString const DOMString &    other
 

Copy constructor.

Parameters:
other The object to be copied.

DOMString::DOMString const XMLCh *    other
 

Constructor to build a DOMString from an XML character array. (XMLCh is a 16 bit UNICODE character).

Parameters:
other The null-terminated character array to be that provides the initial value for the DOMString.

DOMString::DOMString const XMLCh *    other,
unsigned int    length
 

Constructor to build a DOMString from a character array of given length.

Parameters:
other The character array to be imported into the DOMString
length The length of the character array to be imported

DOMString::DOMString const char *    other
 

Constructor to build a DOMString from an 8 bit character array. The char * string will be transcoded to UNICODE using the default code page on the system where the code is running.

Parameters:
other The character array to be imported into the DOMString

DOMString::DOMString int    nullPointerValue
 

Construct a null DOMString.

DOMString::~DOMString  
 

Destructor for DOMString


Member Function Documentation

void DOMString::appendData const XMLCh *    other
 

Append a null-terminated XMLCh * (Unicode) string to this string.

Parameters:
other The object to be appended

void DOMString::appendData XMLCh    ch
 

Append a single Unicode character to this string.

Parameters:
ch The single character to be appended

void DOMString::appendData const DOMString &    other
 

Appends the content of another DOMString to this string.

Parameters:
other The object to be appended

XMLCh DOMString::charAt unsigned int    index const
 

Returns the character at the specified position.

Parameters:
index The position at which the character is being requested
Returns:
Returns the character at the specified position.

DOMString DOMString::clone   const
 

Makes a clone of a the DOMString.

Returns:
The object to be cloned.

int DOMString::compareString const DOMString &    other const
 

Compares a DOMString with another.

This compareString does not match the semantics of the standard C strcmp. All it needs to do is define some less than - equals - greater than ordering of strings. How doesn't matter.

Parameters:
other The object to be compared with
Returns:
Either -1, 0, or 1 based on the comparison.

void DOMString::deleteData unsigned int    offset,
unsigned int    count
 

Clears the data of this DOMString.

Parameters:
offset The position from the beginning from which the data must be deleted
count The count of characters from the offset that must be deleted

bool DOMString::equals const XMLCh *    other const
 

Compare a DOMString with a null-terminated raw 16-bit character string.

Parameters:
other The character string to be compared with.
Returns:
True if the strings are the same, false otherwise.

bool DOMString::equals const DOMString &    other const
 

Tells if a DOMString contains the same character data as another.

Parameters:
other The DOMString to be compared with.
Returns:
True if the two DOMStrings are same, false otherwise.

void DOMString::insertData unsigned int    offset,
const DOMString &    data
 

Inserts a string within the existing DOMString at an arbitrary position.

Parameters:
offset The offset from the beginning at which the insertion needs to be done in this object
data The DOMString containing the data that needs to be inserted
Returns:
The object to be returned.

unsigned int DOMString::length   const
 

Returns the length of the DOMString.

Returns:
The length of the string

bool DOMString::operator!= const DOM_NullPtr *    other const
 

Inequality operator, for null test.

Parameters:
other must be 0 or null.
Returns:
True if the two strings are different, false otherwise

bool DOMString::operator!= const DOMString &    other const
 

Inequality operator.

Parameters:
other The object to be compared with.
Returns:
True if the two DOMStrings refer to different underlying strings in memory.
WARNING: operator == does NOT compare the contents of the two strings. To do this, use the DOMString::equals() This behavior is modelled after the String operations in Java, and is also similar to operator == on the other DOM_* classes.

DOMString & DOMString::operator+= XMLCh    ch
 

Appends a character to this string.

Parameters:
ch The character to be appended

DOMString & DOMString::operator+= const XMLCh *    other
 

Appends the content of a c-style string to this string.

Parameters:
other The string to be appended

DOMString & DOMString::operator+= const DOMString &    other
 

Appends the content of another DOMString to this string.

Parameters:
other The object to be appended

DOMString & DOMString::operator= const DOMString &    other
 

Assignment operator. Make destination DOMString refer to the same underlying string in memory as the source string.

Parameters:
other the source DOMString.

bool DOMString::operator== const DOM_NullPtr *    other const
 

Equality operator. Test for a null DOMString, which is one that does not refer to any string at all; similar to a null object reference variable in Java.

Parameters:
other must be 0 or null.
Returns:

bool DOMString::operator== const DOMString &    other const
 

Equality operator.

Parameters:
other The object to be compared with.
Returns:
True if the two DOMStrings refer to the same underlying string in memory.
WARNING: operator == does NOT compare the contents of the two strings. To do this, use the DOMString::equals() This behavior is modelled after the String operations in Java, and is also similar to operator == on the other DOM_* classes.

void DOMString::print   const
 

Dumps the DOMString on the console.

void DOMString::println   const
 

Dumps the DOMString on the console with a line feed at the end.

const XMLCh * DOMString::rawBuffer   const
 

Returns a handle to the raw buffer in the DOMString.

Returns:
The pointer inside the DOMString containg the string data. Note: the data is not always null terminated. Do not rely on a null being there, and do not add one, as several DOMStrings with different lengths may share the same raw buffer.

void DOMString::reserve unsigned int    size
 

Preallocate storage in the string to hold a given number of characters. A DOMString will grow its buffer on demand, as characters are added, but it can be more efficient to allocate once in advance, if the size is known.

Parameters:
size The number of 16 bit characters to reserve.

DOMString DOMString::substringData unsigned int    offset,
unsigned int    count
const
 

Returns a sub-string of the DOMString starting at a specified position.

Parameters:
offset The offset from the beginning from which the sub-string is being requested.
count The count of characters in the requested sub-string
Returns:
The sub-string of the DOMString being requested

DOMString DOMString::transcode const char *    str [static]
 

Creates a DOMString, transcoded from an input 8 bit char * string in the local code page.

Parameters:
str The string to be transcoded
Returns:
A new DOMString object

char * DOMString::transcode   const
 

Returns a copy of the string, transcoded to the local code page. The caller owns the (char *) string that is returned, and is responsible for deleting it.

Returns:
A pointer to a newly allocated buffer of char elements, which represents the original string, but in the local encoding.


The documentation for this class was generated from the following files:
Generated on Tue Nov 19 09:36:40 2002 by doxygen1.3-rc1