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

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
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  

XMLEntityDecl.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 1999-2003 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: XMLEntityDecl.hpp,v $
00059  * Revision 1.9  2003/12/01 23:23:25  neilg
00060  * fix for bug 25118; thanks to Jeroen Witmond
00061  *
00062  * Revision 1.8  2003/10/10 16:23:29  peiyongz
00063  * Implementation of Serialization/Deserialization
00064  *
00065  * Revision 1.7  2003/05/16 21:36:55  knoaman
00066  * Memory manager implementation: Modify constructors to pass in the memory manager.
00067  *
00068  * Revision 1.6  2003/05/15 18:26:07  knoaman
00069  * Partial implementation of the configurable memory manager.
00070  *
00071  * Revision 1.5  2003/04/21 20:46:01  knoaman
00072  * Use XMLString::release to prepare for configurable memory manager.
00073  *
00074  * Revision 1.4  2003/03/07 18:08:10  tng
00075  * Return a reference instead of void for operator=
00076  *
00077  * Revision 1.3  2002/11/04 15:00:21  tng
00078  * C++ Namespace Support.
00079  *
00080  * Revision 1.2  2002/08/22 19:27:41  tng
00081  * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
00082  *
00083  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
00084  * sane_include
00085  *
00086  * Revision 1.6  2000/02/24 20:00:23  abagchi
00087  * Swat for removing Log from API docs
00088  *
00089  * Revision 1.5  2000/02/16 23:03:48  roddey
00090  * More documentation updates
00091  *
00092  * Revision 1.4  2000/02/16 21:42:58  aruna1
00093  * API Doc++ summary changes in
00094  *
00095  * Revision 1.3  2000/02/15 01:21:30  roddey
00096  * Some initial documentation improvements. More to come...
00097  *
00098  * Revision 1.2  2000/02/06 07:47:48  rahulj
00099  * Year 2K copyright swat.
00100  *
00101  * Revision 1.1.1.1  1999/11/09 01:08:32  twl
00102  * Initial checkin
00103  *
00104  * Revision 1.2  1999/11/08 20:44:38  rahul
00105  * Swat for adding in Product name and CVS comment log variable.
00106  *
00107  */
00108 
00109 #if !defined(XMLENTITYDECL_HPP)
00110 #define XMLENTITYDECL_HPP
00111 
00112 #include <xercesc/util/XMemory.hpp>
00113 #include <xercesc/util/PlatformUtils.hpp>
00114 #include <xercesc/util/XMLString.hpp>
00115 #include <xercesc/internal/XSerializable.hpp>
00116 
00117 XERCES_CPP_NAMESPACE_BEGIN
00118 
00137 class  XMLEntityDecl : public XSerializable, public XMemory
00138 {
00139 public:
00140     // -----------------------------------------------------------------------
00141     //  Constructors and Destructor
00142     // -----------------------------------------------------------------------
00143 
00146 
00150     XMLEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00151 
00158     XMLEntityDecl
00159     (
00160         const   XMLCh* const    entName
00161         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00162     );
00163 
00172     XMLEntityDecl
00173     (
00174         const   XMLCh* const    entName
00175         , const XMLCh* const    value
00176         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00177     );
00178 
00187     XMLEntityDecl
00188     (
00189         const   XMLCh* const    entName
00190         , const XMLCh           value
00191         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00192     );
00194 
00197 
00201     virtual ~XMLEntityDecl();
00202 
00204 
00205 
00206     // -----------------------------------------------------------------------
00207     //  Virtual entity decl interface
00208     // -----------------------------------------------------------------------
00209 
00212 
00220     virtual bool getDeclaredInIntSubset() const = 0;
00221 
00227     virtual bool getIsParameter() const = 0;
00228 
00234     virtual bool getIsSpecialChar() const = 0;
00235 
00237 
00238 
00239     // -----------------------------------------------------------------------
00240     //  Getter methods
00241     // -----------------------------------------------------------------------
00242 
00245 
00250     unsigned int getId() const;
00251 
00257     const XMLCh* getName() const;
00258 
00263     const XMLCh* getNotationName() const;
00264 
00269     const XMLCh* getPublicId() const;
00270 
00275     const XMLCh* getSystemId() const;
00276 
00280     const XMLCh* getBaseURI() const;
00281 
00287     const XMLCh* getValue() const;
00288 
00294     unsigned int getValueLen() const;
00295 
00300     bool isExternal() const;
00301 
00307     bool isUnparsed() const;
00308 
00316     MemoryManager* getMemoryManager() const;
00317 
00319 
00320 
00321     // -----------------------------------------------------------------------
00322     //  Setter methods
00323     // -----------------------------------------------------------------------
00324 
00327 
00336     void setName
00337     (
00338         const   XMLCh* const    entName
00339     );
00340 
00347     void setNotationName(const XMLCh* const newName);
00348 
00355     void setPublicId(const XMLCh* const newId);
00356 
00366     void setSystemId(const XMLCh* const newId);
00367 
00374     void setBaseURI(const XMLCh* const newId);
00375 
00383     void setValue(const XMLCh* const newValue);
00384 
00386 
00387     /* For internal use only */
00388     void setId(const unsigned int newId);
00389 
00390 
00391     // -----------------------------------------------------------------------
00392     //  Support named pool syntax
00393     // -----------------------------------------------------------------------
00394 
00397 
00404     const XMLCh* getKey() const;
00405 
00407 
00408     /***
00409      * Support for Serialization/De-serialization
00410      ***/
00411     DECL_XSERIALIZABLE(XMLEntityDecl)
00412 
00413 private :
00414     // -----------------------------------------------------------------------
00415     //  Unimplemented constructors and operators
00416     // -----------------------------------------------------------------------
00417     XMLEntityDecl(const XMLEntityDecl&);
00418     XMLEntityDecl& operator=(XMLEntityDecl&);
00419 
00420 
00421     // -----------------------------------------------------------------------
00422     //  XMLEntityDecl: Private helper methods
00423     // -----------------------------------------------------------------------
00424     void cleanUp();
00425 
00426 
00427     // -----------------------------------------------------------------------
00428     //  Private data members
00429     //
00430     //  fId
00431     //      This is the unique id given to this entity decl.
00432     //
00433     //  fName
00434     //      The name of the enitity. Entity names are never namespace based.
00435     //
00436     //  fNotationName
00437     //      The optional notation of the entity. If there was none, then its
00438     //      empty.
00439     //
00440     //  fPublicId
00441     //      The public id of the entity, which can be empty.
00442     //
00443     //  fSystemId
00444     //      The system id of the entity.
00445     //
00446     //  fValue
00447     //  fValueLen
00448     //      The entity's value and length, which is only valid if its an
00449     //      internal style entity.
00450     //
00451     //  fBaseURI
00452     //      The base URI of the entity.   According to XML InfoSet, such value
00453     //      is the URI where it is declared (NOT referenced).
00454     // -----------------------------------------------------------------------
00455     unsigned int    fId;
00456     unsigned int    fValueLen;
00457     XMLCh*          fValue;
00458     XMLCh*          fName;
00459     XMLCh*          fNotationName;
00460     XMLCh*          fPublicId;
00461     XMLCh*          fSystemId;
00462     XMLCh*          fBaseURI;
00463     MemoryManager*  fMemoryManager;
00464 };
00465 
00466 
00467 // ---------------------------------------------------------------------------
00468 //  XMLEntityDecl: Getter methods
00469 // ---------------------------------------------------------------------------
00470 inline unsigned int XMLEntityDecl::getId() const
00471 {
00472     return fId;
00473 }
00474 
00475 inline const XMLCh* XMLEntityDecl::getName() const
00476 {
00477     return fName;
00478 }
00479 
00480 inline const XMLCh* XMLEntityDecl::getNotationName() const
00481 {
00482     return fNotationName;
00483 }
00484 
00485 inline const XMLCh* XMLEntityDecl::getPublicId() const
00486 {
00487     return fPublicId;
00488 }
00489 
00490 inline const XMLCh* XMLEntityDecl::getSystemId() const
00491 {
00492     return fSystemId;
00493 }
00494 
00495 inline const XMLCh* XMLEntityDecl::getBaseURI() const
00496 {
00497     return fBaseURI;
00498 }
00499 
00500 inline const XMLCh* XMLEntityDecl::getValue() const
00501 {
00502     return fValue;
00503 }
00504 
00505 inline unsigned int XMLEntityDecl::getValueLen() const
00506 {
00507     return fValueLen;
00508 }
00509 
00510 inline bool XMLEntityDecl::isExternal() const
00511 {
00512     // If it has a system or public id, its external
00513     return ((fPublicId != 0) || (fSystemId != 0));
00514 }
00515 
00516 inline bool XMLEntityDecl::isUnparsed() const
00517 {
00518     // If it has a notation, its unparsed
00519     return (fNotationName != 0);
00520 }
00521 
00522 inline MemoryManager* XMLEntityDecl::getMemoryManager() const
00523 {
00524     return fMemoryManager;
00525 }
00526 
00527 // ---------------------------------------------------------------------------
00528 //  XMLEntityDecl: Setter methods
00529 // ---------------------------------------------------------------------------
00530 inline void XMLEntityDecl::setId(const unsigned int newId)
00531 {
00532     fId = newId;
00533 }
00534 
00535 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
00536 {
00537     if (fNotationName)
00538         fMemoryManager->deallocate(fNotationName);
00539 
00540     fNotationName = XMLString::replicate(newName, fMemoryManager);
00541 }
00542 
00543 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
00544 {
00545     if (fPublicId)
00546         fMemoryManager->deallocate(fPublicId);
00547 
00548     fPublicId = XMLString::replicate(newId, fMemoryManager);
00549 }
00550 
00551 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
00552 {
00553     if (fSystemId)
00554         fMemoryManager->deallocate(fSystemId);
00555 
00556     fSystemId = XMLString::replicate(newId, fMemoryManager);
00557 }
00558 
00559 inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
00560 {
00561     if (fBaseURI)
00562         fMemoryManager->deallocate(fBaseURI);
00563 
00564     fBaseURI = XMLString::replicate(newId, fMemoryManager);
00565 }
00566 
00567 inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
00568 {
00569     if (fValue)
00570         fMemoryManager->deallocate(fValue);
00571 
00572     fValue = XMLString::replicate(newValue, fMemoryManager);
00573     fValueLen = XMLString::stringLen(newValue);
00574 }
00575 
00576 
00577 // ---------------------------------------------------------------------------
00578 //  XMLEntityDecl: Support named pool syntax
00579 // ---------------------------------------------------------------------------
00580 inline const XMLCh* XMLEntityDecl::getKey() const
00581 {
00582     return fName;
00583 }
00584 
00585 XERCES_CPP_NAMESPACE_END
00586 
00587 #endif


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