http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Installation
Build

API Docs
Samples
Programming
Migration
FAQs

Releases
Feedback
Bug-Todo

Download
CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DOMString Class Reference

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

#include <DOMString.hpp>

List of all members.

Functions to get properties of the string.

XMLCh charAt (unsigned int index) const
 Returns the character at the specified position. More...

const XMLCh* rawBuffer () const
 Returns a handle to the raw buffer in the DOMString. More...

char* transcode () const
 Returns a copy of the string, transcoded to the local code page. More...

DOMString substringData (unsigned int offset, unsigned int count) const
 Returns a sub-string of the DOMString starting at a specified position. More...

unsigned int length () const
 Returns the length of the DOMString. More...

DOMString transcode (const char* str)
 Creates a DOMString, transcoded from an input 8 bit char * string in the local code page. More...


Public Methods

Constructors and assignment operator
 DOMString ()
 Default constructor for DOMString. More...

 DOMString (const DOMString &other)
 Copy constructor. More...

 DOMString (const XMLCh *other)
 Constructor to build a DOMString from an XML character array. More...

 DOMString (const XMLCh *other, unsigned int length)
 Constructor to build a DOMString from a character array of given length. More...

 DOMString (const char *other)
 Constructor to build a DOMString from an 8 bit character array. More...

 DOMString (int nullPointerValue)
 Construct a null DOMString.

DOMString& operator= (const DOMString &other)
 Assignment operator. More...

DOMString& operator= (DOM_NullPtr *other)
Destructor.
 ~DOMString ()
 Destructor for DOMString.

Equality and Inequality operators.
bool operator== (const DOMString &other) const
 Equality operator. More...

bool operator!= (const DOMString &other) const
 Inequality operator. More...

bool operator== (const DOM_NullPtr *other) const
 Equality operator. More...

bool operator!= (const DOM_NullPtr *other) const
 Inequality operator, for null test. More...

Functions to change the string.
void reserve (unsigned int size)
 Preallocate storage in the string to hold a given number of characters. More...

void appendData (const DOMString &other)
 Appends the content of another DOMString to this string. More...

void appendData (XMLCh ch)
 Append a single Unicode character to this string. More...

void appendData (const XMLCh *other)
 Append a null-terminated XMLCh * (Unicode) string to this string. More...

DOMString& operator+= (const DOMString &other)
 Appends the content of another DOMString to this string. More...

DOMString& operator+= (const XMLCh* other)
 Appends the content of a c-style string to this string. More...

DOMString& operator+= (XMLCh ch)
 Appends a character to this string. More...

void deleteData (unsigned int offset, unsigned int count)
 Clears the data of this DOMString. More...

void insertData (unsigned int offset, const DOMString &data)
 Inserts a string within the existing DOMString at an arbitrary position. More...

Cloning function.
DOMString clone () const
 Makes a clone of a the DOMString. More...

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 compareString (const DOMString &other) const
 Compares a DOMString with another. More...

bool equals (const DOMString &other) const
 Tells if a DOMString contains the same character data as another. More...

bool equals (const XMLCh *other) const
 Compare a DOMString with a null-terminated raw 16-bit character string. More...


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:
other   The object 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= ( DOM_NullPtr * other )
 

DOMString & 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.

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.


Friends And Related Function Documentation

class DOMStringData [friend]
 

class DOMStringHandle [friend]
 

class DomMemDebug [friend]
 


The documentation for this class was generated from the following file:


Copyright © 2000 The Apache Software Foundation. All Rights Reserved.