Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:53

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP
0024 
0025 #include <xercesc/util/XMemory.hpp>
0026 #include <xercesc/util/PlatformUtils.hpp>
0027 #include <xercesc/util/XMLString.hpp>
0028 #include <xercesc/internal/XSerializable.hpp>
0029 
0030 XERCES_CPP_NAMESPACE_BEGIN
0031 
0032 /**
0033  *  This class represents the core information about a notation declaration
0034  *  that all validators must at least support. Each validator will create a
0035  *  derivative of this class which adds any information it requires for its
0036  *  own extra needs.
0037  *
0038  *  At this common level, the information supported is the notation name
0039  *  and the public and sysetm ids indicated in the notation declaration.
0040  */
0041 class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
0042 {
0043 public:
0044     // -----------------------------------------------------------------------
0045     //  Constructors and Destructor
0046     // -----------------------------------------------------------------------
0047 
0048     /** @name Constructors */
0049     //@{
0050     XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0051     XMLNotationDecl
0052     (
0053         const   XMLCh* const    notName
0054         , const XMLCh* const    pubId
0055         , const XMLCh* const    sysId
0056         , const XMLCh* const    baseURI = 0
0057         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
0058     );
0059     //@}
0060 
0061     /** @name Destructor */
0062     //@{
0063     ~XMLNotationDecl();
0064     //@}
0065 
0066 
0067     // -----------------------------------------------------------------------
0068     //  Getter methods
0069     // -----------------------------------------------------------------------
0070     XMLSize_t getId() const;
0071     const XMLCh* getName() const;
0072     const XMLCh* getPublicId() const;
0073     const XMLCh* getSystemId() const;
0074     const XMLCh* getBaseURI() const;
0075     unsigned int getNameSpaceId() const;
0076     MemoryManager* getMemoryManager() const;
0077 
0078 
0079     // -----------------------------------------------------------------------
0080     //  Setter methods
0081     // -----------------------------------------------------------------------
0082     void setId(const XMLSize_t newId);
0083     void setName
0084     (
0085         const   XMLCh* const    notName
0086     );
0087     void setPublicId(const XMLCh* const newId);
0088     void setSystemId(const XMLCh* const newId);
0089     void setBaseURI(const XMLCh* const newId);
0090     void setNameSpaceId(const unsigned int newId);
0091 
0092     // -----------------------------------------------------------------------
0093     //  Support named collection element semantics
0094     // -----------------------------------------------------------------------
0095     const XMLCh* getKey() const;
0096 
0097     /***
0098      * Support for Serialization/De-serialization
0099      ***/
0100     DECL_XSERIALIZABLE(XMLNotationDecl)
0101 
0102 private :
0103     // -----------------------------------------------------------------------
0104     //  Unimplemented constructors and operators
0105     // -----------------------------------------------------------------------
0106     XMLNotationDecl(const XMLNotationDecl&);
0107     XMLNotationDecl& operator=(const XMLNotationDecl&);
0108 
0109 
0110     // -----------------------------------------------------------------------
0111     //  XMLNotationDecl: Private helper methods
0112     // -----------------------------------------------------------------------
0113     void cleanUp();
0114 
0115 
0116     // -----------------------------------------------------------------------
0117     //  Private data members
0118     //
0119     //  fId
0120     //      This is the unique id given to this notation decl.
0121     //
0122     //  fName
0123     //      The notation's name, which identifies the type of notation it
0124     //      applies to.
0125     //
0126     //  fPublicId
0127     //      The text of the notation's public id, if any.
0128     //
0129     //  fSystemId
0130     //      The text of the notation's system id, if any.
0131     //
0132     //  fBaseURI
0133     //      The text of the notation's base URI
0134     // -----------------------------------------------------------------------
0135     XMLSize_t       fId;
0136     unsigned int    fNameSpaceId;
0137     XMLCh*          fName;
0138     XMLCh*          fPublicId;
0139     XMLCh*          fSystemId;
0140     XMLCh*          fBaseURI;
0141     MemoryManager*  fMemoryManager;
0142 };
0143 
0144 
0145 // -----------------------------------------------------------------------
0146 //  Getter methods
0147 // -----------------------------------------------------------------------
0148 inline XMLSize_t XMLNotationDecl::getId() const
0149 {
0150     return fId;
0151 }
0152 
0153 inline const XMLCh* XMLNotationDecl::getName() const
0154 {
0155     return fName;
0156 }
0157 
0158 inline unsigned int XMLNotationDecl::getNameSpaceId() const
0159 {
0160     return fNameSpaceId;
0161 }
0162 
0163 inline const XMLCh* XMLNotationDecl::getPublicId() const
0164 {
0165     return fPublicId;
0166 }
0167 
0168 inline const XMLCh* XMLNotationDecl::getSystemId() const
0169 {
0170     return fSystemId;
0171 }
0172 
0173 inline const XMLCh* XMLNotationDecl::getBaseURI() const
0174 {
0175     return fBaseURI;
0176 }
0177 
0178 inline MemoryManager* XMLNotationDecl::getMemoryManager() const
0179 {
0180     return fMemoryManager;
0181 }
0182 
0183 // -----------------------------------------------------------------------
0184 //  Setter methods
0185 // -----------------------------------------------------------------------
0186 inline void XMLNotationDecl::setId(const XMLSize_t newId)
0187 {
0188     fId = newId;
0189 }
0190 
0191 inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
0192 {
0193     fNameSpaceId = newId;
0194 }
0195 
0196 inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
0197 {
0198     if (fPublicId)
0199         fMemoryManager->deallocate(fPublicId);
0200 
0201     fPublicId = XMLString::replicate(newId, fMemoryManager);
0202 }
0203 
0204 inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
0205 {
0206     if (fSystemId)
0207         fMemoryManager->deallocate(fSystemId);
0208 
0209     fSystemId = XMLString::replicate(newId, fMemoryManager);
0210 }
0211 
0212 inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
0213 {
0214     if (fBaseURI)
0215         fMemoryManager->deallocate(fBaseURI);
0216 
0217     fBaseURI = XMLString::replicate(newId, fMemoryManager);
0218 }
0219 
0220 
0221 // ---------------------------------------------------------------------------
0222 //  XMLNotationDecl: Support named pool element semantics
0223 // ---------------------------------------------------------------------------
0224 inline const XMLCh* XMLNotationDecl::getKey() const
0225 {
0226     return fName;
0227 }
0228 
0229 XERCES_CPP_NAMESPACE_END
0230 
0231 #endif