XMLEntityDecl.hpp Source File

| 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.7  2003/05/16 21:36:55  knoaman
    00060  * Memory manager implementation: Modify constructors to pass in the memory manager.
    00061  *
    00062  * Revision 1.6  2003/05/15 18:26:07  knoaman
    00063  * Partial implementation of the configurable memory manager.
    00064  *
    00065  * Revision 1.5  2003/04/21 20:46:01  knoaman
    00066  * Use XMLString::release to prepare for configurable memory manager.
    00067  *
    00068  * Revision 1.4  2003/03/07 18:08:10  tng
    00069  * Return a reference instead of void for operator=
    00070  *
    00071  * Revision 1.3  2002/11/04 15:00:21  tng
    00072  * C++ Namespace Support.
    00073  *
    00074  * Revision 1.2  2002/08/22 19:27:41  tng
    00075  * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
    00076  *
    00077  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
    00078  * sane_include
    00079  *
    00080  * Revision 1.6  2000/02/24 20:00:23  abagchi
    00081  * Swat for removing Log from API docs
    00082  *
    00083  * Revision 1.5  2000/02/16 23:03:48  roddey
    00084  * More documentation updates
    00085  *
    00086  * Revision 1.4  2000/02/16 21:42:58  aruna1
    00087  * API Doc++ summary changes in
    00088  *
    00089  * Revision 1.3  2000/02/15 01:21:30  roddey
    00090  * Some initial documentation improvements. More to come...
    00091  *
    00092  * Revision 1.2  2000/02/06 07:47:48  rahulj
    00093  * Year 2K copyright swat.
    00094  *
    00095  * Revision 1.1.1.1  1999/11/09 01:08:32  twl
    00096  * Initial checkin
    00097  *
    00098  * Revision 1.2  1999/11/08 20:44:38  rahul
    00099  * Swat for adding in Product name and CVS comment log variable.
    00100  *
    00101  */
    00102
    00103 #if !defined(XMLENTITYDECL_HPP)
    00104 #define XMLENTITYDECL_HPP
    00105
    00106 #include <xercesc/util/XMemory.hpp>
    00107 #include <xercesc/util/PlatformUtils.hpp>
    00108 #include <xercesc/util/XMLString.hpp>
    00109
    00110 XERCES_CPP_NAMESPACE_BEGIN
    00111
    00130 class  XMLEntityDecl : public XMemory
    00131 {
    00132 public:
    00133     // -----------------------------------------------------------------------
    00134     //  Constructors and Destructor
    00135     // -----------------------------------------------------------------------
    00136
    00139
    00143     XMLEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00144
    00149     XMLEntityDecl
    00150     (
    00151         const   XMLCh* const    entName
    00152         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00153     );
    00154
    00161     XMLEntityDecl
    00162     (
    00163         const   XMLCh* const    entName
    00164         , const XMLCh* const    value
    00165         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00166     );
    00167
    00174     XMLEntityDecl
    00175     (
    00176         const   XMLCh* const    entName
    00177         , const XMLCh           value
    00178         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00179     );
    00181
    00184
    00188     virtual ~XMLEntityDecl();
    00189
    00191
    00192
    00193     // -----------------------------------------------------------------------
    00194     //  Virtual entity decl interface
    00195     // -----------------------------------------------------------------------
    00196
    00199
    00207     virtual bool getDeclaredInIntSubset() const = 0;
    00208
    00214     virtual bool getIsParameter() const = 0;
    00215
    00221     virtual bool getIsSpecialChar() const = 0;
    00222
    00224
    00225
    00226     // -----------------------------------------------------------------------
    00227     //  Getter methods
    00228     // -----------------------------------------------------------------------
    00229
    00232
    00237     unsigned int getId() const;
    00238
    00244     const XMLCh* getName() const;
    00245
    00250     const XMLCh* getNotationName() const;
    00251
    00256     const XMLCh* getPublicId() const;
    00257
    00262     const XMLCh* getSystemId() const;
    00263
    00267     const XMLCh* getBaseURI() const;
    00268
    00274     const XMLCh* getValue() const;
    00275
    00281     unsigned int getValueLen() const;
    00282
    00287     bool isExternal() const;
    00288
    00294     bool isUnparsed() const;
    00295
    00303     MemoryManager* getMemoryManager() const;
    00304
    00306
    00307
    00308     // -----------------------------------------------------------------------
    00309     //  Setter methods
    00310     // -----------------------------------------------------------------------
    00311
    00314
    00323     void setName
    00324     (
    00325         const   XMLCh* const    entName
    00326     );
    00327
    00334     void setNotationName(const XMLCh* const newName);
    00335
    00342     void setPublicId(const XMLCh* const newId);
    00343
    00353     void setSystemId(const XMLCh* const newId);
    00354
    00361     void setBaseURI(const XMLCh* const newId);
    00362
    00370     void setValue(const XMLCh* const newValue);
    00371
    00373
    00374     /* For internal use only */
    00375     void setId(const unsigned int newId);
    00376
    00377
    00378     // -----------------------------------------------------------------------
    00379     //  Support named pool syntax
    00380     // -----------------------------------------------------------------------
    00381
    00384
    00391     const XMLCh* getKey() const;
    00392
    00394
    00395
    00396 private :
    00397     // -----------------------------------------------------------------------
    00398     //  Unimplemented constructors and operators
    00399     // -----------------------------------------------------------------------
    00400     XMLEntityDecl(const XMLEntityDecl&);
    00401     XMLEntityDecl& operator=(XMLEntityDecl&);
    00402
    00403
    00404     // -----------------------------------------------------------------------
    00405     //  XMLEntityDecl: Private helper methods
    00406     // -----------------------------------------------------------------------
    00407     void cleanUp();
    00408
    00409
    00410     // -----------------------------------------------------------------------
    00411     //  Private data members
    00412     //
    00413     //  fId
    00414     //      This is the unique id given to this entity decl.
    00415     //
    00416     //  fName
    00417     //      The name of the enitity. Entity names are never namespace based.
    00418     //
    00419     //  fNotationName
    00420     //      The optional notation of the entity. If there was none, then its
    00421     //      empty.
    00422     //
    00423     //  fPublicId
    00424     //      The public id of the entity, which can be empty.
    00425     //
    00426     //  fSystemId
    00427     //      The system id of the entity.
    00428     //
    00429     //  fValue
    00430     //  fValueLen
    00431     //      The entity's value and length, which is only valid if its an
    00432     //      internal style entity.
    00433     //
    00434     //  fBaseURI
    00435     //      The base URI of the entity.   According to XML InfoSet, such value
    00436     //      is the URI where it is declared (NOT referenced).
    00437     // -----------------------------------------------------------------------
    00438     unsigned int    fId;
    00439     unsigned int    fValueLen;
    00440     XMLCh*          fValue;
    00441     XMLCh*          fName;
    00442     XMLCh*          fNotationName;
    00443     XMLCh*          fPublicId;
    00444     XMLCh*          fSystemId;
    00445     XMLCh*          fBaseURI;
    00446     MemoryManager*  fMemoryManager;
    00447 };
    00448
    00449
    00450 // ---------------------------------------------------------------------------
    00451 //  XMLEntityDecl: Getter methods
    00452 // ---------------------------------------------------------------------------
    00453 inline unsigned int XMLEntityDecl::getId() const
    00454 {
    00455     return fId;
    00456 }
    00457
    00458 inline const XMLCh* XMLEntityDecl::getName() const
    00459 {
    00460     return fName;
    00461 }
    00462
    00463 inline const XMLCh* XMLEntityDecl::getNotationName() const
    00464 {
    00465     return fNotationName;
    00466 }
    00467
    00468 inline const XMLCh* XMLEntityDecl::getPublicId() const
    00469 {
    00470     return fPublicId;
    00471 }
    00472
    00473 inline const XMLCh* XMLEntityDecl::getSystemId() const
    00474 {
    00475     return fSystemId;
    00476 }
    00477
    00478 inline const XMLCh* XMLEntityDecl::getBaseURI() const
    00479 {
    00480     return fBaseURI;
    00481 }
    00482
    00483 inline const XMLCh* XMLEntityDecl::getValue() const
    00484 {
    00485     return fValue;
    00486 }
    00487
    00488 inline unsigned int XMLEntityDecl::getValueLen() const
    00489 {
    00490     return fValueLen;
    00491 }
    00492
    00493 inline bool XMLEntityDecl::isExternal() const
    00494 {
    00495     // If it has a system or public id, its external
    00496     return ((fPublicId != 0) || (fSystemId != 0));
    00497 }
    00498
    00499 inline bool XMLEntityDecl::isUnparsed() const
    00500 {
    00501     // If it has a notation, its unparsed
    00502     return (fNotationName != 0);
    00503 }
    00504
    00505 inline MemoryManager* XMLEntityDecl::getMemoryManager() const
    00506 {
    00507     return fMemoryManager;
    00508 }
    00509
    00510 // ---------------------------------------------------------------------------
    00511 //  XMLEntityDecl: Setter methods
    00512 // ---------------------------------------------------------------------------
    00513 inline void XMLEntityDecl::setId(const unsigned int newId)
    00514 {
    00515     fId = newId;
    00516 }
    00517
    00518 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
    00519 {
    00520     if (fNotationName)
    00521         fMemoryManager->deallocate(fNotationName);
    00522
    00523     fNotationName = XMLString::replicate(newName, fMemoryManager);
    00524 }
    00525
    00526 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
    00527 {
    00528     if (fPublicId)
    00529         fMemoryManager->deallocate(fPublicId);
    00530
    00531     fPublicId = XMLString::replicate(newId, fMemoryManager);
    00532 }
    00533
    00534 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
    00535 {
    00536     if (fSystemId)
    00537         fMemoryManager->deallocate(fSystemId);
    00538
    00539     fSystemId = XMLString::replicate(newId, fMemoryManager);
    00540 }
    00541
    00542 inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
    00543 {
    00544     if (fBaseURI)
    00545         fMemoryManager->deallocate(fBaseURI);
    00546
    00547     fBaseURI = XMLString::replicate(newId, fMemoryManager);
    00548 }
    00549
    00550 inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
    00551 {
    00552     if (fValue)
    00553         fMemoryManager->deallocate(fValue);
    00554
    00555     fValue = XMLString::replicate(newValue, fMemoryManager);
    00556     fValueLen = XMLString::stringLen(newValue);
    00557 }
    00558
    00559
    00560 // ---------------------------------------------------------------------------
    00561 //  XMLEntityDecl: Support named pool syntax
    00562 // ---------------------------------------------------------------------------
    00563 inline const XMLCh* XMLEntityDecl::getKey() const
    00564 {
    00565     return fName;
    00566 }
    00567
    00568 XERCES_CPP_NAMESPACE_END
    00569
    00570 #endif

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