| 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  * Copyright 1999-2004 The Apache Software Foundation.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *      http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 /*
    00018  * $Log: XMLEntityDecl.hpp,v $
    00019  * Revision 1.10  2004/09/08 13:55:59  peiyongz
    00020  * Apache License Version 2.0
    00021  *
    00022  * Revision 1.9  2003/12/01 23:23:25  neilg
    00023  * fix for bug 25118; thanks to Jeroen Witmond
    00024  *
    00025  * Revision 1.8  2003/10/10 16:23:29  peiyongz
    00026  * Implementation of Serialization/Deserialization
    00027  *
    00028  * Revision 1.7  2003/05/16 21:36:55  knoaman
    00029  * Memory manager implementation: Modify constructors to pass in the memory manager.
    00030  *
    00031  * Revision 1.6  2003/05/15 18:26:07  knoaman
    00032  * Partial implementation of the configurable memory manager.
    00033  *
    00034  * Revision 1.5  2003/04/21 20:46:01  knoaman
    00035  * Use XMLString::release to prepare for configurable memory manager.
    00036  *
    00037  * Revision 1.4  2003/03/07 18:08:10  tng
    00038  * Return a reference instead of void for operator=
    00039  *
    00040  * Revision 1.3  2002/11/04 15:00:21  tng
    00041  * C++ Namespace Support.
    00042  *
    00043  * Revision 1.2  2002/08/22 19:27:41  tng
    00044  * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
    00045  *
    00046  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
    00047  * sane_include
    00048  *
    00049  * Revision 1.6  2000/02/24 20:00:23  abagchi
    00050  * Swat for removing Log from API docs
    00051  *
    00052  * Revision 1.5  2000/02/16 23:03:48  roddey
    00053  * More documentation updates
    00054  *
    00055  * Revision 1.4  2000/02/16 21:42:58  aruna1
    00056  * API Doc++ summary changes in
    00057  *
    00058  * Revision 1.3  2000/02/15 01:21:30  roddey
    00059  * Some initial documentation improvements. More to come...
    00060  *
    00061  * Revision 1.2  2000/02/06 07:47:48  rahulj
    00062  * Year 2K copyright swat.
    00063  *
    00064  * Revision 1.1.1.1  1999/11/09 01:08:32  twl
    00065  * Initial checkin
    00066  *
    00067  * Revision 1.2  1999/11/08 20:44:38  rahul
    00068  * Swat for adding in Product name and CVS comment log variable.
    00069  *
    00070  */
    00071
    00072 #if !defined(XMLENTITYDECL_HPP)
    00073 #define XMLENTITYDECL_HPP
    00074
    00075 #include <xercesc/util/XMemory.hpp>
    00076 #include <xercesc/util/PlatformUtils.hpp>
    00077 #include <xercesc/util/XMLString.hpp>
    00078 #include <xercesc/internal/XSerializable.hpp>
    00079
    00080 XERCES_CPP_NAMESPACE_BEGIN
    00081
    00100 class  XMLEntityDecl : public XSerializable, public XMemory
    00101 {
    00102 public:
    00103     // -----------------------------------------------------------------------
    00104     //  Constructors and Destructor
    00105     // -----------------------------------------------------------------------
    00106
    00109
    00113     XMLEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00114
    00121     XMLEntityDecl
    00122     (
    00123         const   XMLCh* const    entName
    00124         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00125     );
    00126
    00135     XMLEntityDecl
    00136     (
    00137         const   XMLCh* const    entName
    00138         , const XMLCh* const    value
    00139         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00140     );
    00141
    00150     XMLEntityDecl
    00151     (
    00152         const   XMLCh* const    entName
    00153         , const XMLCh           value
    00154         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00155     );
    00157
    00160
    00164     virtual ~XMLEntityDecl();
    00165
    00167
    00168
    00169     // -----------------------------------------------------------------------
    00170     //  Virtual entity decl interface
    00171     // -----------------------------------------------------------------------
    00172
    00175
    00183     virtual bool getDeclaredInIntSubset() const = 0;
    00184
    00190     virtual bool getIsParameter() const = 0;
    00191
    00197     virtual bool getIsSpecialChar() const = 0;
    00198
    00200
    00201
    00202     // -----------------------------------------------------------------------
    00203     //  Getter methods
    00204     // -----------------------------------------------------------------------
    00205
    00208
    00213     unsigned int getId() const;
    00214
    00220     const XMLCh* getName() const;
    00221
    00226     const XMLCh* getNotationName() const;
    00227
    00232     const XMLCh* getPublicId() const;
    00233
    00238     const XMLCh* getSystemId() const;
    00239
    00243     const XMLCh* getBaseURI() const;
    00244
    00250     const XMLCh* getValue() const;
    00251
    00257     unsigned int getValueLen() const;
    00258
    00263     bool isExternal() const;
    00264
    00270     bool isUnparsed() const;
    00271
    00279     MemoryManager* getMemoryManager() const;
    00280
    00282
    00283
    00284     // -----------------------------------------------------------------------
    00285     //  Setter methods
    00286     // -----------------------------------------------------------------------
    00287
    00290
    00299     void setName
    00300     (
    00301         const   XMLCh* const    entName
    00302     );
    00303
    00310     void setNotationName(const XMLCh* const newName);
    00311
    00318     void setPublicId(const XMLCh* const newId);
    00319
    00329     void setSystemId(const XMLCh* const newId);
    00330
    00337     void setBaseURI(const XMLCh* const newId);
    00338
    00346     void setValue(const XMLCh* const newValue);
    00347
    00349
    00350     /* For internal use only */
    00351     void setId(const unsigned int newId);
    00352
    00353
    00354     // -----------------------------------------------------------------------
    00355     //  Support named pool syntax
    00356     // -----------------------------------------------------------------------
    00357
    00360
    00367     const XMLCh* getKey() const;
    00368
    00370
    00371     /***
    00372      * Support for Serialization/De-serialization
    00373      ***/
    00374     DECL_XSERIALIZABLE(XMLEntityDecl)
    00375
    00376 private :
    00377     // -----------------------------------------------------------------------
    00378     //  Unimplemented constructors and operators
    00379     // -----------------------------------------------------------------------
    00380     XMLEntityDecl(const XMLEntityDecl&);
    00381     XMLEntityDecl& operator=(XMLEntityDecl&);
    00382
    00383
    00384     // -----------------------------------------------------------------------
    00385     //  XMLEntityDecl: Private helper methods
    00386     // -----------------------------------------------------------------------
    00387     void cleanUp();
    00388
    00389
    00390     // -----------------------------------------------------------------------
    00391     //  Private data members
    00392     //
    00393     //  fId
    00394     //      This is the unique id given to this entity decl.
    00395     //
    00396     //  fName
    00397     //      The name of the enitity. Entity names are never namespace based.
    00398     //
    00399     //  fNotationName
    00400     //      The optional notation of the entity. If there was none, then its
    00401     //      empty.
    00402     //
    00403     //  fPublicId
    00404     //      The public id of the entity, which can be empty.
    00405     //
    00406     //  fSystemId
    00407     //      The system id of the entity.
    00408     //
    00409     //  fValue
    00410     //  fValueLen
    00411     //      The entity's value and length, which is only valid if its an
    00412     //      internal style entity.
    00413     //
    00414     //  fBaseURI
    00415     //      The base URI of the entity.   According to XML InfoSet, such value
    00416     //      is the URI where it is declared (NOT referenced).
    00417     // -----------------------------------------------------------------------
    00418     unsigned int    fId;
    00419     unsigned int    fValueLen;
    00420     XMLCh*          fValue;
    00421     XMLCh*          fName;
    00422     XMLCh*          fNotationName;
    00423     XMLCh*          fPublicId;
    00424     XMLCh*          fSystemId;
    00425     XMLCh*          fBaseURI;
    00426     MemoryManager*  fMemoryManager;
    00427 };
    00428
    00429
    00430 // ---------------------------------------------------------------------------
    00431 //  XMLEntityDecl: Getter methods
    00432 // ---------------------------------------------------------------------------
    00433 inline unsigned int XMLEntityDecl::getId() const
    00434 {
    00435     return fId;
    00436 }
    00437
    00438 inline const XMLCh* XMLEntityDecl::getName() const
    00439 {
    00440     return fName;
    00441 }
    00442
    00443 inline const XMLCh* XMLEntityDecl::getNotationName() const
    00444 {
    00445     return fNotationName;
    00446 }
    00447
    00448 inline const XMLCh* XMLEntityDecl::getPublicId() const
    00449 {
    00450     return fPublicId;
    00451 }
    00452
    00453 inline const XMLCh* XMLEntityDecl::getSystemId() const
    00454 {
    00455     return fSystemId;
    00456 }
    00457
    00458 inline const XMLCh* XMLEntityDecl::getBaseURI() const
    00459 {
    00460     return fBaseURI;
    00461 }
    00462
    00463 inline const XMLCh* XMLEntityDecl::getValue() const
    00464 {
    00465     return fValue;
    00466 }
    00467
    00468 inline unsigned int XMLEntityDecl::getValueLen() const
    00469 {
    00470     return fValueLen;
    00471 }
    00472
    00473 inline bool XMLEntityDecl::isExternal() const
    00474 {
    00475     // If it has a system or public id, its external
    00476     return ((fPublicId != 0) || (fSystemId != 0));
    00477 }
    00478
    00479 inline bool XMLEntityDecl::isUnparsed() const
    00480 {
    00481     // If it has a notation, its unparsed
    00482     return (fNotationName != 0);
    00483 }
    00484
    00485 inline MemoryManager* XMLEntityDecl::getMemoryManager() const
    00486 {
    00487     return fMemoryManager;
    00488 }
    00489
    00490 // ---------------------------------------------------------------------------
    00491 //  XMLEntityDecl: Setter methods
    00492 // ---------------------------------------------------------------------------
    00493 inline void XMLEntityDecl::setId(const unsigned int newId)
    00494 {
    00495     fId = newId;
    00496 }
    00497
    00498 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
    00499 {
    00500     if (fNotationName)
    00501         fMemoryManager->deallocate(fNotationName);
    00502
    00503     fNotationName = XMLString::replicate(newName, fMemoryManager);
    00504 }
    00505
    00506 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
    00507 {
    00508     if (fPublicId)
    00509         fMemoryManager->deallocate(fPublicId);
    00510
    00511     fPublicId = XMLString::replicate(newId, fMemoryManager);
    00512 }
    00513
    00514 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
    00515 {
    00516     if (fSystemId)
    00517         fMemoryManager->deallocate(fSystemId);
    00518
    00519     fSystemId = XMLString::replicate(newId, fMemoryManager);
    00520 }
    00521
    00522 inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
    00523 {
    00524     if (fBaseURI)
    00525         fMemoryManager->deallocate(fBaseURI);
    00526
    00527     fBaseURI = XMLString::replicate(newId, fMemoryManager);
    00528 }
    00529
    00530 inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
    00531 {
    00532     if (fValue)
    00533         fMemoryManager->deallocate(fValue);
    00534
    00535     fValue = XMLString::replicate(newValue, fMemoryManager);
    00536     fValueLen = XMLString::stringLen(newValue);
    00537 }
    00538
    00539
    00540 // ---------------------------------------------------------------------------
    00541 //  XMLEntityDecl: Support named pool syntax
    00542 // ---------------------------------------------------------------------------
    00543 inline const XMLCh* XMLEntityDecl::getKey() const
    00544 {
    00545     return fName;
    00546 }
    00547
    00548 XERCES_CPP_NAMESPACE_END
    00549
    00550 #endif

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