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

Home

Readme
Download
Installation
Build

API Docs
Samples
Schema

FAQs
Programming
Migration

Releases
Bug-Reporting
Feedback

Y2K Compliance
PDF Document

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.2  2002/02/20 18:17:00  tng
00060  * [Bug 5977] Warnings on generating apiDocs.
00061  *
00062  * Revision 1.1.1.1  2002/02/01 22:21:44  peiyongz
00063  * sane_include
00064  *
00065  * Revision 1.12  2000/06/02 00:45:42  andyh
00066  * DOM Fixes:  DOMString::rawBuffer() now returns a const XMLCh * pointer.
00067  * Two plain deletes changed to array deletes.
00068  *
00069  * Revision 1.11  2000/03/02 19:53:52  roddey
00070  * This checkin includes many changes done while waiting for the
00071  * 1.1.0 code to be finished. I can't list them all here, but a list is
00072  * available elsewhere.
00073  *
00074  * Revision 1.10  2000/02/24 20:11:27  abagchi
00075  * Swat for removing Log from API docs
00076  *
00077  * Revision 1.9  2000/02/16 22:54:56  abagchi
00078  * Switched the order of  DomString for operators, to make OS/390 happy
00079  *
00080  * Revision 1.8  2000/02/06 07:47:27  rahulj
00081  * Year 2K copyright swat.
00082  *
00083  * Revision 1.7  2000/02/04 05:06:30  andyh
00084  * Change all DOMString offsets and lengths form signed to unsigned
00085  * Other misc. cleanups.
00086  *
00087  * Revision 1.6  2000/02/04 00:52:58  rahulj
00088  * Changed size_t to int.
00089  *
00090  * Revision 1.5  2000/02/03 23:07:27  andyh
00091  * Add several new functions from Robert Weir to DOMString.
00092  *
00093  * Revision 1.4  2000/01/05 22:16:26  robweir
00094  * Move DOMString implementation class declarations into a new
00095  * file: DOMStringImpl.hpp.  Include this header in DOMString.hpp
00096  * for XML_DEBUG builds so the underlying character array will be
00097  * visible in the debugger.  <robert_weir@lotus.com>
00098  *
00099  * Revision 1.3  1999/12/03 00:11:22  andyh
00100  * Added DOMString.clone() to node parameters in and out of the DOM,
00101  * where they had been missed.
00102  *
00103  * DOMString::rawBuffer, removed incorrect assumptions about it
00104  * being null terminated.
00105  *
00106  * Revision 1.2  1999/11/30 21:16:25  roddey
00107  * Changes to add the transcode() method to DOMString, which returns a transcoded
00108  * version (to local code page) of the DOM string contents. And I changed all of the
00109  * exception 'throw by pointer' to 'throw by value' style.
00110  *
00111  * Revision 1.1.1.1  1999/11/09 01:08:48  twl
00112  * Initial checkin
00113  *
00114  * Revision 1.2  1999/11/08 20:44:12  rahul
00115  * Swat for adding in Product name and CVS comment log variable.
00116  *
00117  */
00118 
00119 #ifndef DOMString_HEADER_GUARD_
00120 #define DOMString_HEADER_GUARD_
00121 
00122 #include <xercesc/util/XercesDefs.hpp>
00123 
00124 #ifdef XML_DEBUG
00125 #include "DOMStringImpl.hpp"
00126 #else
00127 class DOMStringHandle;
00128 #endif
00129 
00130 class DOM_NullPtr;
00131 
00139 
00140 class  DOMString {
00141 public:
00144 
00149     DOMString();
00150 
00156     DOMString(const DOMString &other);
00157 
00165     DOMString(const XMLCh *other);
00166 
00173     DOMString(const XMLCh *other, unsigned int length);
00174 
00182     DOMString(const char *other);
00183 
00187     DOMString(int nullPointerValue);
00188 
00195     DOMString &        operator = (const DOMString &other);
00196 
00197 
00198 
00199     DOMString &        operator = (DOM_NullPtr *other);
00200 
00202 
00204 
00209     ~DOMString();
00210 
00212 
00214 
00221     // DOMString   operator + (const DOMString &other);
00222 
00224 
00226 
00239     bool        operator == (const DOMString &other) const;
00240 
00253     bool        operator != (const DOMString &other) const;
00254 
00263     bool        operator == (const DOM_NullPtr *other) const;
00264 
00271     bool        operator != (const DOM_NullPtr *other) const;
00272 
00274 
00276 
00277 
00285     void reserve(unsigned int size);
00286 
00287 
00293     void        appendData(const DOMString &other);
00294 
00300     void        appendData(XMLCh ch);
00301 
00307     void        appendData(const XMLCh *other);
00308 
00309 
00315     DOMString& operator +=(const DOMString &other);
00316 
00317 
00323     DOMString& operator +=(const XMLCh* other);
00324 
00325 
00331     DOMString& operator +=(XMLCh ch);
00332 
00333 
00340     void        deleteData(unsigned int offset, unsigned int count);
00341 
00350     void        insertData(unsigned int offset, const DOMString &data);
00351 
00353 
00355 
00362     XMLCh       charAt(unsigned int index) const;
00363 
00372     const XMLCh *rawBuffer() const;
00373 
00382     char        *transcode() const;
00383 
00384 
00392     static DOMString transcode(const char* str);
00393 
00394 
00395 
00403     DOMString   substringData(unsigned int offset, unsigned int count) const;
00404 
00410     unsigned int length() const;
00411 
00413 
00415 
00421     DOMString   clone() const;
00422 
00424 
00426 
00431     void        print() const;
00432 
00437     void        println() const;
00438 
00440 
00442 
00454     int         compareString(const DOMString &other) const;
00455 
00463     bool        equals(const DOMString &other) const;
00464 
00465 
00473     bool        equals(const XMLCh  *other) const;
00474 
00475 
00477     friend      class DOMStringData;
00478     friend      class DOMStringHandle;
00479     friend      class DomMemDebug;
00480 private:
00481 
00482     DOMStringHandle         *fHandle;
00483     static int              gLiveStringHandleCount;
00484     static int              gTotalStringHandleCount;
00485     static int              gLiveStringDataCount;
00486     static int              gTotalStringDataCount;
00487 };
00488 
00489 
00490 /****** Global Helper Functions ******/
00491 
00499 DOMString  operator + (const DOMString &lhs, const DOMString &rhs);
00500 
00508 DOMString  operator + (const DOMString &lhs, const XMLCh* rhs);
00509 
00510 
00518 DOMString  operator + (const XMLCh* lhs, const DOMString &rhs);
00519 
00520 
00528 DOMString  operator + (const DOMString &lhs, XMLCh rhs);
00529 
00530 
00538 DOMString  operator + (XMLCh lhs, const DOMString &rhs);
00539 
00540 #endif


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