Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AttributesImpl.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 #if !defined(ATTRIBUTESIMPL_HEADER_GUARD_1357924680)
00017 #define ATTRIBUTESIMPL_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 // Base include file.  Must be first.
00022 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
00023 
00024 
00025 
00026 #include <xalanc/Include/XalanVector.hpp>
00027 
00028 
00029 
00030 #include <xercesc/sax2/Attributes.hpp>
00031 
00032 
00033 
00034 XALAN_CPP_NAMESPACE_BEGIN
00035 
00036 
00037 
00038 class AttributeVectorEntryExtended;
00039 
00040 
00041 
00042 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes   AttributesType;
00043 
00044 
00045 
00046 class XALAN_PLATFORMSUPPORT_EXPORT AttributesImpl : public AttributesType
00047 {
00048 public:
00049 
00050     explicit
00051     AttributesImpl(MemoryManagerType&      theManager XALAN_DEFAULT_MEMMGR);
00052 
00053     virtual
00054     ~AttributesImpl();
00055 
00056     AttributesImpl(const AttributesImpl&    theSource,
00057                     MemoryManagerType&      theManager);
00058 
00059     AttributesImpl(const AttributesType&    theSource,
00060                     MemoryManagerType&      theManager);
00061 
00062     AttributesImpl&
00063     operator=(const AttributesImpl&     theRHS);
00064 
00065     AttributesImpl&
00066     operator=(const AttributesType&     theRHS);
00067 
00068     // These are inherited from AttributeList
00069     virtual unsigned int
00070     getLength() const;
00071 
00072     virtual const XMLCh*
00073     getURI(const unsigned int index) const;
00074 
00075     virtual const XMLCh*
00076     getLocalName(const unsigned int index) const;
00077 
00078     virtual const XMLCh*
00079     getQName(const unsigned int index) const;
00080 
00081     virtual const XMLCh*
00082     getType(const unsigned int index) const;
00083 
00084     virtual const XMLCh*
00085     getValue(const unsigned int index) const;
00086 
00087     virtual int
00088     getIndex(
00089             const XMLCh* const  uri,
00090             const XMLCh* const  localName) const;
00091 
00092     virtual int
00093     getIndex(const XMLCh* const     qname) const;
00094 
00095     virtual const XMLCh*
00096     getType(const XMLCh* const qname) const;
00097 
00098     virtual const XMLCh*
00099     getType(
00100             const XMLCh* const  uri,
00101             const XMLCh* const  localName) const;
00102 
00103     virtual const XMLCh*
00104     getValue(const XMLCh* const qname) const;
00105 
00106     virtual const XMLCh*
00107     getValue(
00108             const XMLCh* const  uri,
00109             const XMLCh* const  localName) const;
00110 
00111     MemoryManagerType&
00112     getMemoryManager()
00113     {
00114         return m_attributesVector.getMemoryManager();
00115     }
00116 
00117     // The mutators are new to this class.
00118 
00122     virtual void
00123     clear();
00124 
00133     void
00134     addAttribute(
00135             const XMLCh*    qname,
00136             const XMLCh*    type,
00137             const XMLCh*    value)
00138     {
00139         const XMLCh     theDummy = 0;
00140 
00141         addAttribute(&theDummy, &theDummy, qname, type, value);
00142     }
00143 
00154     void
00155     addAttribute(
00156             const XMLCh*    uri,
00157             const XMLCh*    localName,
00158             const XMLCh*    qname,
00159             const XMLCh*    type,
00160             const XMLCh*    value);
00161 
00167     virtual bool
00168     removeAttribute(const XMLCh*    qname);
00169 
00176     void
00177     swap(AttributesImpl&        theOther)
00178     {
00179         m_attributesVector.swap(theOther.m_attributesVector);
00180     }
00181 
00188     void
00189     reserve(unsigned int    theCount)
00190     {
00191         m_attributesVector.reserve(theCount);
00192     }
00193 
00194     // This vector will hold the entries.
00195     typedef XalanVector<AttributeVectorEntryExtended*>      AttributesVectorType;
00196 
00197 #if defined(XALAN_NEEDS_EXPLICIT_TEMPLATE_INSTANTIATION)
00198     struct NameCompareFunctor
00199     {
00200         NameCompareFunctor(const XMLCh*     theQName) :
00201             m_qname(theQName)
00202         {
00203         }
00204 
00205         bool
00206         operator()(const AttributeVectorEntryExtended*  theEntry) const;
00207 
00208     private:
00209 
00210         const XMLCh* const  m_qname;
00211     };
00212 
00213     struct URIAndLocalNameCompareFunctor
00214     {
00215         URIAndLocalNameCompareFunctor(
00216                 const XMLCh*    theURI,
00217                 const XMLCh*    theLocalName) :
00218             m_uri(theURI),
00219             m_localName(theLocalName)
00220         {
00221         }
00222 
00223         bool
00224         operator()(const AttributeVectorEntryExtended*  theEntry) const;
00225 
00226     private:
00227 
00228         const XMLCh* const  m_uri;
00229         const XMLCh* const  m_localName;
00230     };
00231 #endif
00232 
00233 private:
00234 
00235     // This is not implemented.
00236     bool
00237     operator==(const AttributesImpl&) const;
00238 
00239     // Default vector allocation size.
00240     enum
00241     {
00242         eDefaultVectorSize = 5
00243     };
00244 
00245     AttributeVectorEntryExtended*
00246     getNewEntry(
00247             const XMLCh*    qname,
00248             const XMLCh*    type,
00249             const XMLCh*    value,
00250             const XMLCh*    uri = 0,
00251             const XMLCh*    localName = 0);
00252 
00253     // Helper function to delete entries...
00254     static void
00255     deleteEntries(AttributesVectorType&     theVector);
00256 
00257     AttributesVectorType    m_attributesVector;
00258 
00259     AttributesVectorType    m_cacheVector;
00260 };
00261 
00262 
00263 
00264 XALAN_CPP_NAMESPACE_END
00265 
00266 
00267 
00268 #endif  // ATTRIBUTESIMPL_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo