00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(ATTRIBUTESIMPL_HEADER_GUARD_1357924680) 00019 #define ATTRIBUTESIMPL_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/Include/XalanVector.hpp> 00029 00030 00031 00032 #include <xercesc/sax2/Attributes.hpp> 00033 00034 00035 00036 XALAN_CPP_NAMESPACE_BEGIN 00037 00038 00039 00040 class AttributeVectorEntryExtended; 00041 00042 00043 00044 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType; 00045 00046 00047 00048 class XALAN_PLATFORMSUPPORT_EXPORT AttributesImpl : public AttributesType 00049 { 00050 public: 00051 00052 explicit 00053 AttributesImpl(MemoryManager& theManager XALAN_DEFAULT_MEMMGR); 00054 00055 virtual 00056 ~AttributesImpl(); 00057 00058 AttributesImpl(const AttributesImpl& theSource, 00059 MemoryManager& theManager); 00060 00061 AttributesImpl(const AttributesType& theSource, 00062 MemoryManager& theManager); 00063 00064 AttributesImpl& 00065 operator=(const AttributesImpl& theRHS); 00066 00067 AttributesImpl& 00068 operator=(const AttributesType& theRHS); 00069 00070 // These are inherited from Attributes 00071 virtual XalanSize_t 00072 getLength() const; 00073 00074 virtual const XMLCh* 00075 getURI(const XalanSize_t index) const; 00076 00077 virtual const XMLCh* 00078 getLocalName(const XalanSize_t index) const; 00079 00080 virtual const XMLCh* 00081 getQName(const XalanSize_t index) const; 00082 00083 virtual const XMLCh* 00084 getType(const XalanSize_t index) const; 00085 00086 virtual const XMLCh* 00087 getValue(const XalanSize_t index) const; 00088 00089 virtual bool 00090 getIndex( 00091 const XMLCh* const uri, 00092 const XMLCh* const localPart, 00093 XalanSize_t& index) const; 00094 00095 virtual int 00096 getIndex( 00097 const XMLCh* const uri, 00098 const XMLCh* const localPart) const; 00099 00100 virtual bool 00101 getIndex( 00102 const XMLCh* const qName, 00103 XalanSize_t& index) const; 00104 00105 virtual int 00106 getIndex(const XMLCh* const qname) const; 00107 00108 virtual const XMLCh* 00109 getType(const XMLCh* const qname) const; 00110 00111 virtual const XMLCh* 00112 getType( 00113 const XMLCh* const uri, 00114 const XMLCh* const localName) const; 00115 00116 virtual const XMLCh* 00117 getValue(const XMLCh* const qname) const; 00118 00119 virtual const XMLCh* 00120 getValue( 00121 const XMLCh* const uri, 00122 const XMLCh* const localName) const; 00123 00124 MemoryManager& 00125 getMemoryManager() 00126 { 00127 return m_attributesVector.getMemoryManager(); 00128 } 00129 00130 // The mutators are new to this class. 00131 00132 /** 00133 * Remove all attributes from the list 00134 */ 00135 virtual void 00136 clear(); 00137 00138 /** 00139 * Adds an attribute to the attribute list. Does not check for 00140 * duplicates. 00141 * 00142 * @param qname attribute qname 00143 * @param type attribute type, "CDATA," for example 00144 * @param value attribute value 00145 */ 00146 void 00147 addAttribute( 00148 const XMLCh* qname, 00149 const XMLCh* type, 00150 const XMLCh* value) 00151 { 00152 const XMLCh theDummy = 0; 00153 00154 addAttribute(&theDummy, &theDummy, qname, type, value); 00155 } 00156 00157 /** 00158 * Adds an attribute to the attribute list. Does not check for 00159 * duplicates. 00160 * 00161 * @param uri attribute namespace URI 00162 * @param localName attribute local name 00163 * @param qname attribute qname 00164 * @param type attribute type, "CDATA," for example 00165 * @param value attribute value 00166 */ 00167 void 00168 addAttribute( 00169 const XMLCh* uri, 00170 const XMLCh* localName, 00171 const XMLCh* qname, 00172 const XMLCh* type, 00173 const XMLCh* value); 00174 00175 /** 00176 * Removes an attribute from the attribute list 00177 * 00178 * @param qname attribute qname 00179 */ 00180 virtual bool 00181 removeAttribute(const XMLCh* qname); 00182 00183 /** 00184 * Swap the contents of two instances. This must _never_ 00185 * throw an exception. 00186 * 00187 * @param thOther The instance with which to swap. 00188 */ 00189 void 00190 swap(AttributesImpl& theOther) 00191 { 00192 m_attributesVector.swap(theOther.m_attributesVector); 00193 } 00194 00195 /** 00196 * Reserve room for the given number of 00197 * attributes. 00198 * 00199 * @param theCount The number to reserve 00200 */ 00201 void 00202 reserve(XalanSize_t theCount) 00203 { 00204 m_attributesVector.reserve(theCount); 00205 } 00206 00207 // This vector will hold the entries. 00208 typedef XalanVector<AttributeVectorEntryExtended*> AttributesVectorType; 00209 00210 private: 00211 00212 // This is not implemented. 00213 bool 00214 operator==(const AttributesImpl&) const; 00215 00216 // Default vector allocation size. 00217 enum 00218 { 00219 eDefaultVectorSize = 5 00220 }; 00221 00222 AttributeVectorEntryExtended* 00223 getNewEntry( 00224 const XMLCh* qname, 00225 const XMLCh* type, 00226 const XMLCh* value, 00227 const XMLCh* uri = 0, 00228 const XMLCh* localName = 0); 00229 00230 // Helper function to delete entries... 00231 static void 00232 deleteEntries(AttributesVectorType& theVector); 00233 00234 AttributesVectorType m_attributesVector; 00235 00236 AttributesVectorType m_cacheVector; 00237 }; 00238 00239 00240 00241 XALAN_CPP_NAMESPACE_END 00242 00243 00244 00245 #endif // ATTRIBUTESIMPL_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|