class DOMString

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

Inheritance:


Public

Cloning function.
DOMString clone () const
Makes a clone of a the DOMString
Constructors and assignment operator
DOMString ()
Default constructor for DOMString
DOMString (const DOMString &other)
Copy constructor
DOMString (const XMLCh *other)
Constructor to build a DOMString from an XML character array
DOMString (const XMLCh *other, int length)
Constructor to build a DOMString from a character array of given length
DOMString (const char *other)
Constructor to build a DOMString from an 8 bit character array
DOMString (int initalBufferSize)
Constructor to build an empty DOMString with the character buffer preallocated to the specified size
DOMString& operator = (const DOMString &other)
Assignment operator
Destructor.
~DOMString ()
Destructor for DOMString
Equality and Inequality operators.
bool operator == (const DOMString &other) const
Equality operator
bool operator != (const DOMString &other) const
Inequality operator
bool operator == (const DOM_NullPtr *other) const
Equality operator
bool operator != (const DOM_NullPtr *other) const
Inequality operator, for null test
Functions to change the string.
void appendData (const DOMString &other)
Appends the content of another DOMString to this string
void deleteData (int offset, int count)
Clears the data of this DOMString
void insertData (int offset, const DOMString &data)
Inserts a string within the existing DOMString at an arbitrary position
Functions to compare a string with another.
int strcmp (const DOMString &other) const
Compares a DOMString with another
bool equals (const DOMString &other) const
Tells if a DOMString contains the same character data as another
bool equals (const XMLCh *other) const
Compare a DOMString with a null-terminated raw 16-bit character string
Functions to get properties of the string.
XMLCh charAt (int index) const
Returns the character at the specified position
XMLCh* rawBuffer () const
Returns a handle to the raw buffer in the DOMString
DOMString substringData (int offset, int count) const
Returns a sub-string of the DOMString starting at a specified position
int length () const
Returns the length of the DOMString
Operators for string manipulation.
DOMString operator + (const DOMString &other)
Concatenate a DOMString to another
Print functions.
void print () const
Dumps the DOMString on the console
void println () const
Dumps the DOMString on the console with a line feed at the end

Documentation

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.
Constructors and assignment operator

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

DOMString(const DOMString &other)
Copy constructor.
Parameters:
other - The object to be copied.

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(const XMLCh *other, 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(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(int initalBufferSize)
Constructor to build an empty DOMString with the character buffer preallocated to the specified size. 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:
initialBufferSize - The initial size of the buffer inside the DOMString, measured in 16 bit characters.

DOMString& operator = (const DOMString &other)
Assignment operator. Make destination DOMString refer to the same underlying string in memory as the source string.
Parameters:
the - source DOMString.

Destructor.

~DOMString()
Destructor for DOMString

Operators for string manipulation.

DOMString operator + (const DOMString &other)
Concatenate a DOMString to another.
Returns:
The concatenated object
Parameters:
other - The string to be concatenated.

Equality and Inequality operators.

bool operator == (const DOMString &other) const
Equality operator.
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.

Parameters:
other - The object to be compared with.

bool operator != (const DOMString &other) const
Inequality operator.
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.

Parameters:
other - The object to be compared with.

bool 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.

bool operator != (const DOM_NullPtr *other) const
Inequality operator, for null test.
Returns:
True if the two strings are different, false otherwise
Parameters:
other - must be 0 or null.

Functions to change the string.

void appendData(const DOMString &other)
Appends the content of another DOMString to this string.
Parameters:
other - The object to be appended

void deleteData(int offset, 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

void insertData(int offset, const DOMString &data)
Inserts a string within the existing DOMString at an arbitrary position.
Returns:
The object to be returned.
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

Functions to get properties of the string.

XMLCh charAt(int index) const
Returns the character at the specified position.
Returns:
Returns the character at the specified position.
Parameters:
index - The position at which the character is being requested

XMLCh* rawBuffer() const
Returns a handle to the raw buffer in the DOMString.
Returns:
The pointer inside the DOMString containg the string data.

DOMString substringData(int offset, int count) const
Returns a sub-string of the DOMString starting at a specified position.
Returns:
The sub-string of the DOMString being requested
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

int length() const
Returns the length of the DOMString.
Returns:
The length of the string

Cloning function.

DOMString clone() const
Makes a clone of a the DOMString.
Returns:
The object to be cloned.

Print functions.

void print() const
Dumps the DOMString on the console

void println() const
Dumps the DOMString on the console with a line feed at the end

Functions to compare a string with another.

int strcmp(const DOMString &other) const
Compares a DOMString with another. This strcmp 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.
Returns:
Either -1, 0, or 1 based on the comparison.
Parameters:
other - The object to be compared with

bool equals(const DOMString &other) const
Tells if a DOMString contains the same character data as another.
Returns:
True if the two DOMStrings are same, false otherwise.
Parameters:
other - The DOMString to be compared with.

bool equals(const XMLCh *other) const
Compare a DOMString with a null-terminated raw 16-bit character string.
Returns:
True if the strings are the same, false otherwise.
Parameters:
other - The character string to be compared with.


This class has no child classes.

alphabetic index hierarchy of classes


XML Parser for C++ 2.0
Copyright © IBM Corp, 1999
Center for Java Technology
10275 N. De Anza Blvd.
Cupertino CA 95014 USA
Email: xml4c@us.ibm.com

IBM Logo