00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 /* 00019 * $Id$ 00020 */ 00021 00022 #if !defined(XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP) 00023 #define XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP 00024 00025 #include <xercesc/util/XMemory.hpp> 00026 #include <xercesc/util/PlatformUtils.hpp> 00027 #include <xercesc/util/XMLString.hpp> 00028 #include <xercesc/internal/XSerializable.hpp> 00029 00030 XERCES_CPP_NAMESPACE_BEGIN 00031 00041 class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory 00042 { 00043 public: 00044 // ----------------------------------------------------------------------- 00045 // Constructors and Destructor 00046 // ----------------------------------------------------------------------- 00047 00050 XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00051 XMLNotationDecl 00052 ( 00053 const XMLCh* const notName 00054 , const XMLCh* const pubId 00055 , const XMLCh* const sysId 00056 , const XMLCh* const baseURI = 0 00057 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00058 ); 00060 00063 ~XMLNotationDecl(); 00065 00066 00067 // ----------------------------------------------------------------------- 00068 // Getter methods 00069 // ----------------------------------------------------------------------- 00070 XMLSize_t getId() const; 00071 const XMLCh* getName() const; 00072 const XMLCh* getPublicId() const; 00073 const XMLCh* getSystemId() const; 00074 const XMLCh* getBaseURI() const; 00075 unsigned int getNameSpaceId() const; 00076 MemoryManager* getMemoryManager() const; 00077 00078 00079 // ----------------------------------------------------------------------- 00080 // Setter methods 00081 // ----------------------------------------------------------------------- 00082 void setId(const XMLSize_t newId); 00083 void setName 00084 ( 00085 const XMLCh* const notName 00086 ); 00087 void setPublicId(const XMLCh* const newId); 00088 void setSystemId(const XMLCh* const newId); 00089 void setBaseURI(const XMLCh* const newId); 00090 void setNameSpaceId(const unsigned int newId); 00091 00092 // ----------------------------------------------------------------------- 00093 // Support named collection element semantics 00094 // ----------------------------------------------------------------------- 00095 const XMLCh* getKey() const; 00096 00097 /*** 00098 * Support for Serialization/De-serialization 00099 ***/ 00100 DECL_XSERIALIZABLE(XMLNotationDecl) 00101 00102 private : 00103 // ----------------------------------------------------------------------- 00104 // Unimplemented constructors and operators 00105 // ----------------------------------------------------------------------- 00106 XMLNotationDecl(const XMLNotationDecl&); 00107 XMLNotationDecl& operator=(const XMLNotationDecl&); 00108 00109 00110 // ----------------------------------------------------------------------- 00111 // XMLNotationDecl: Private helper methods 00112 // ----------------------------------------------------------------------- 00113 void cleanUp(); 00114 00115 00116 // ----------------------------------------------------------------------- 00117 // Private data members 00118 // 00119 // fId 00120 // This is the unique id given to this notation decl. 00121 // 00122 // fName 00123 // The notation's name, which identifies the type of notation it 00124 // applies to. 00125 // 00126 // fPublicId 00127 // The text of the notation's public id, if any. 00128 // 00129 // fSystemId 00130 // The text of the notation's system id, if any. 00131 // 00132 // fBaseURI 00133 // The text of the notation's base URI 00134 // ----------------------------------------------------------------------- 00135 XMLSize_t fId; 00136 unsigned int fNameSpaceId; 00137 XMLCh* fName; 00138 XMLCh* fPublicId; 00139 XMLCh* fSystemId; 00140 XMLCh* fBaseURI; 00141 MemoryManager* fMemoryManager; 00142 }; 00143 00144 00145 // ----------------------------------------------------------------------- 00146 // Getter methods 00147 // ----------------------------------------------------------------------- 00148 inline XMLSize_t XMLNotationDecl::getId() const 00149 { 00150 return fId; 00151 } 00152 00153 inline const XMLCh* XMLNotationDecl::getName() const 00154 { 00155 return fName; 00156 } 00157 00158 inline unsigned int XMLNotationDecl::getNameSpaceId() const 00159 { 00160 return fNameSpaceId; 00161 } 00162 00163 inline const XMLCh* XMLNotationDecl::getPublicId() const 00164 { 00165 return fPublicId; 00166 } 00167 00168 inline const XMLCh* XMLNotationDecl::getSystemId() const 00169 { 00170 return fSystemId; 00171 } 00172 00173 inline const XMLCh* XMLNotationDecl::getBaseURI() const 00174 { 00175 return fBaseURI; 00176 } 00177 00178 inline MemoryManager* XMLNotationDecl::getMemoryManager() const 00179 { 00180 return fMemoryManager; 00181 } 00182 00183 // ----------------------------------------------------------------------- 00184 // Setter methods 00185 // ----------------------------------------------------------------------- 00186 inline void XMLNotationDecl::setId(const XMLSize_t newId) 00187 { 00188 fId = newId; 00189 } 00190 00191 inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId) 00192 { 00193 fNameSpaceId = newId; 00194 } 00195 00196 inline void XMLNotationDecl::setPublicId(const XMLCh* const newId) 00197 { 00198 if (fPublicId) 00199 fMemoryManager->deallocate(fPublicId); 00200 00201 fPublicId = XMLString::replicate(newId, fMemoryManager); 00202 } 00203 00204 inline void XMLNotationDecl::setSystemId(const XMLCh* const newId) 00205 { 00206 if (fSystemId) 00207 fMemoryManager->deallocate(fSystemId); 00208 00209 fSystemId = XMLString::replicate(newId, fMemoryManager); 00210 } 00211 00212 inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId) 00213 { 00214 if (fBaseURI) 00215 fMemoryManager->deallocate(fBaseURI); 00216 00217 fBaseURI = XMLString::replicate(newId, fMemoryManager); 00218 } 00219 00220 00221 // --------------------------------------------------------------------------- 00222 // XMLNotationDecl: Support named pool element semantics 00223 // --------------------------------------------------------------------------- 00224 inline const XMLCh* XMLNotationDecl::getKey() const 00225 { 00226 return fName; 00227 } 00228 00229 XERCES_CPP_NAMESPACE_END 00230 00231 #endif