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

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1

00003  * 

00004  * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights

00005  * reserved.

00006  * 

00007  * Redistribution and use in source and binary forms, with or without

00008  * modification, are permitted provided that the following conditions

00009  * are met:

00010  * 

00011  * 1. Redistributions of source code must retain the above copyright

00012  *    notice, this list of conditions and the following disclaimer. 

00013  * 

00014  * 2. Redistributions in binary form must reproduce the above copyright

00015  *    notice, this list of conditions and the following disclaimer in

00016  *    the documentation and/or other materials provided with the

00017  *    distribution.

00018  * 

00019  * 3. The end-user documentation included with the redistribution,

00020  *    if any, must include the following acknowledgment:  

00021  *       "This product includes software developed by the

00022  *        Apache Software Foundation (http://www.apache.org/)."

00023  *    Alternately, this acknowledgment may appear in the software itself,

00024  *    if and wherever such third-party acknowledgments normally appear.

00025  * 

00026  * 4. The names "Xerces" and "Apache Software Foundation" must

00027  *    not be used to endorse or promote products derived from this

00028  *    software without prior written permission. For written 

00029  *    permission, please contact apache\@apache.org.

00030  * 

00031  * 5. Products derived from this software may not be called "Apache",

00032  *    nor may "Apache" appear in their name, without prior written

00033  *    permission of the Apache Software Foundation.

00034  * 

00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED

00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR

00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,

00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF

00046  * SUCH DAMAGE.

00047  * ====================================================================

00048  * 

00049  * This software consists of voluntary contributions made by many

00050  * individuals on behalf of the Apache Software Foundation, and was

00051  * originally based on software copyright (c) 1999, International

00052  * Business Machines, Inc., http://www.ibm.com .  For more information

00053  * on the Apache Software Foundation, please see

00054  * <http://www.apache.org/>.

00055  */
00056 
00057 /*
00058  * $Log: DOMString.hpp,v $

00059  * Revision 1.12  2000/06/02 00:45:42  andyh

00060  * DOM Fixes:  DOMString::rawBuffer() now returns a const XMLCh * pointer.

00061  * Two plain deletes changed to array deletes.

00062  *
00063  * Revision 1.11  2000/03/02 19:53:52  roddey

00064  * This checkin includes many changes done while waiting for the

00065  * 1.1.0 code to be finished. I can't list them all here, but a list is

00066  * available elsewhere.

00067  *
00068  * Revision 1.10  2000/02/24 20:11:27  abagchi

00069  * Swat for removing Log from API docs

00070  *
00071  * Revision 1.9  2000/02/16 22:54:56  abagchi

00072  * Switched the order of  DomString for operators, to make OS/390 happy

00073  *
00074  * Revision 1.8  2000/02/06 07:47:27  rahulj

00075  * Year 2K copyright swat.

00076  *
00077  * Revision 1.7  2000/02/04 05:06:30  andyh

00078  * Change all DOMString offsets and lengths form signed to unsigned

00079  * Other misc. cleanups.

00080  *
00081  * Revision 1.6  2000/02/04 00:52:58  rahulj

00082  * Changed size_t to int.

00083  *
00084  * Revision 1.5  2000/02/03 23:07:27  andyh

00085  * Add several new functions from Robert Weir to DOMString.

00086  *
00087  * Revision 1.4  2000/01/05 22:16:26  robweir

00088  * Move DOMString implementation class declarations into a new

00089  * file: DOMStringImpl.hpp.  Include this header in DOMString.hpp

00090  * for XML_DEBUG builds so the underlying character array will be

00091  * visible in the debugger.  <robert_weir@lotus.com>

00092  *
00093  * Revision 1.3  1999/12/03 00:11:22  andyh

00094  * Added DOMString.clone() to node parameters in and out of the DOM,

00095  * where they had been missed.

00096  *
00097  * DOMString::rawBuffer, removed incorrect assumptions about it

00098  * being null terminated.

00099  *
00100  * Revision 1.2  1999/11/30 21:16:25  roddey

00101  * Changes to add the transcode() method to DOMString, which returns a transcoded

00102  * version (to local code page) of the DOM string contents. And I changed all of the

00103  * exception 'throw by pointer' to 'throw by value' style.

00104  *
00105  * Revision 1.1.1.1  1999/11/09 01:08:48  twl

00106  * Initial checkin

00107  *
00108  * Revision 1.2  1999/11/08 20:44:12  rahul

00109  * Swat for adding in Product name and CVS comment log variable.

00110  *
00111  */
00112 
00113 #ifndef DOMString_HEADER_GUARD_
00114 #define DOMString_HEADER_GUARD_
00115 
00116 #include <util/XercesDefs.hpp>
00117 
00118 #ifdef XML_DEBUG
00119 #include "DOMStringImpl.hpp"
00120 #else
00121 class DOMStringHandle;
00122 #endif
00123 
00124 class DOM_NullPtr;
00125 
00133 
00134 class  DOMString {
00135 public:
00138 
00143     DOMString();
00144 
00150     DOMString(const DOMString &other);
00151 
00159     DOMString(const XMLCh *other);
00160 
00167     DOMString(const XMLCh *other, unsigned int length);
00168 
00176     DOMString(const char *other);
00177 
00181     DOMString(int nullPointerValue);
00182 
00189     DOMString &        operator = (const DOMString &other);
00190 
00191 
00192 
00193     DOMString &        operator = (DOM_NullPtr *other);
00194 
00196 
00198 
00203     ~DOMString();
00204 
00206 
00208 
00215     // DOMString   operator + (const DOMString &other);
00216 
00218 
00220 
00233     bool        operator == (const DOMString &other) const;
00234 
00247     bool        operator != (const DOMString &other) const;
00248 
00257     bool        operator == (const DOM_NullPtr *other) const;
00258 
00265     bool        operator != (const DOM_NullPtr *other) const;
00266 
00268 
00270 
00271 
00279     void reserve(unsigned int size);
00280 
00281     
00287     void        appendData(const DOMString &other);
00288 
00294     void        appendData(XMLCh ch);
00295 
00301     void        appendData(const XMLCh *other);
00302 
00303 
00309     DOMString& operator +=(const DOMString &other);
00310 
00311 
00317     DOMString& operator +=(const XMLCh* other);
00318 
00319 
00325     DOMString& operator +=(XMLCh ch);
00326 
00327 
00334     void        deleteData(unsigned int offset, unsigned int count);
00335 
00344     void        insertData(unsigned int offset, const DOMString &data);
00345 
00347 
00349 
00356     XMLCh       charAt(unsigned int index) const;
00357 
00366     const XMLCh *rawBuffer() const;
00367 
00376     char        *transcode() const;
00377 
00378 
00386     static DOMString transcode(const char* str);
00387 
00388 
00389 
00397     DOMString   substringData(unsigned int offset, unsigned int count) const;
00398 
00404     unsigned int length() const;
00405 
00407 
00409 
00415     DOMString   clone() const;
00416 
00418 
00420 
00425     void        print() const;
00426 
00431     void        println() const;
00432 
00434 
00436 
00448     int         compareString(const DOMString &other) const;
00449 
00457     bool        equals(const DOMString &other) const;
00458 
00459 
00467     bool        equals(const XMLCh  *other) const;
00468 
00469 
00471     friend      class DOMStringData;
00472     friend      class DOMStringHandle;
00473     friend      class DomMemDebug;
00474 private:
00475 
00476     DOMStringHandle         *fHandle;
00477     static int              gLiveStringHandleCount;
00478     static int              gTotalStringHandleCount;
00479     static int              gLiveStringDataCount;
00480     static int              gTotalStringDataCount;
00481 };
00482 
00483 
00484 /****** Global Helper Functions ******/
00485 
00493 DOMString  operator + (const DOMString &lhs, const DOMString &rhs);
00494 
00502 DOMString  operator + (const DOMString &lhs, const XMLCh* rhs);
00503 
00504 
00512 DOMString  operator + (const XMLCh* lhs, const DOMString &rhs);
00513 
00514 
00522 DOMString  operator + (const DOMString &lhs, XMLCh rhs);
00523 
00524 
00532 DOMString  operator + (XMLCh lhs, const DOMString &rhs);
00533 
00534 #endif


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