Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

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 <vector>
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();
00052 
00053     virtual
00054     ~AttributesImpl();
00055 
00056     AttributesImpl(const AttributesImpl&    theSource);
00057 
00058     AttributesImpl(const AttributesType&    theSource);
00059 
00060     AttributesImpl&
00061     operator=(const AttributesImpl&     theRHS);
00062 
00063     AttributesImpl&
00064     operator=(const AttributesType&     theRHS);
00065 
00066     // These are inherited from AttributeList
00067     virtual unsigned int
00068     getLength() const;
00069 
00070     virtual const XMLCh*
00071     getURI(const unsigned int index) const;
00072 
00073     virtual const XMLCh*
00074     getLocalName(const unsigned int index) const;
00075 
00076     virtual const XMLCh*
00077     getQName(const unsigned int index) const;
00078 
00079     virtual const XMLCh*
00080     getType(const unsigned int index) const;
00081 
00082     virtual const XMLCh*
00083     getValue(const unsigned int index) const;
00084 
00085     virtual int
00086     getIndex(
00087             const XMLCh* const  uri,
00088             const XMLCh* const  localName) const;
00089 
00090     virtual int
00091     getIndex(const XMLCh* const     qname) const;
00092 
00093     virtual const XMLCh*
00094     getType(const XMLCh* const qname) const;
00095 
00096     virtual const XMLCh*
00097     getType(
00098             const XMLCh* const  uri,
00099             const XMLCh* const  localName) const;
00100 
00101     virtual const XMLCh*
00102     getValue(const XMLCh* const qname) const;
00103 
00104     virtual const XMLCh*
00105     getValue(
00106             const XMLCh* const  uri,
00107             const XMLCh* const  localName) const;
00108 
00109     // The mutators are new to this class.
00110 
00114     virtual void
00115     clear();
00116 
00125     void
00126     addAttribute(
00127             const XMLCh*    qname,
00128             const XMLCh*    type,
00129             const XMLCh*    value)
00130     {
00131         const XMLCh     theDummy = 0;
00132 
00133         addAttribute(&theDummy, &theDummy, qname, type, value);
00134     }
00135 
00146     void
00147     addAttribute(
00148             const XMLCh*    uri,
00149             const XMLCh*    localName,
00150             const XMLCh*    qname,
00151             const XMLCh*    type,
00152             const XMLCh*    value);
00153 
00159     virtual bool
00160     removeAttribute(const XMLCh*    qname);
00161 
00168     void
00169     swap(AttributesImpl&        theOther)
00170     {
00171         m_attributesVector.swap(theOther.m_attributesVector);
00172     }
00173 
00180     void
00181     reserve(unsigned int    theCount)
00182     {
00183         m_attributesVector.reserve(theCount);
00184     }
00185 
00186 #if defined(XALAN_NO_STD_NAMESPACE)
00187     // This vector will hold the entries.
00188     typedef vector<AttributeVectorEntryExtended*>       AttributesVectorType;
00189 #else
00190     // This vector will hold the entries.
00191     typedef std::vector<AttributeVectorEntryExtended*>  AttributesVectorType;
00192 #endif
00193 
00194 #if defined(XALAN_NEEDS_EXPLICIT_TEMPLATE_INSTANTIATION)
00195     struct NameCompareFunctor
00196     {
00197         NameCompareFunctor(const XMLCh*     theQName) :
00198             m_qname(theQName)
00199         {
00200         }
00201 
00202         bool
00203         operator()(const AttributeVectorEntryExtended*  theEntry) const;
00204 
00205     private:
00206 
00207         const XMLCh* const  m_qname;
00208     };
00209 
00210     struct URIAndLocalNameCompareFunctor
00211     {
00212         URIAndLocalNameCompareFunctor(
00213                 const XMLCh*    theURI,
00214                 const XMLCh*    theLocalName) :
00215             m_uri(theURI),
00216             m_localName(theLocalName)
00217         {
00218         }
00219 
00220         bool
00221         operator()(const AttributeVectorEntryExtended*  theEntry) const;
00222 
00223     private:
00224 
00225         const XMLCh* const  m_uri;
00226         const XMLCh* const  m_localName;
00227     };
00228 #endif
00229 
00230 private:
00231 
00232     // This is not implemented.
00233     bool
00234     operator==(const AttributesImpl&) const;
00235 
00236     // Default vector allocation size.
00237     enum
00238     {
00239         eDefaultVectorSize = 5
00240     };
00241 
00242     AttributeVectorEntryExtended*
00243     getNewEntry(
00244             const XMLCh*    qname,
00245             const XMLCh*    type,
00246             const XMLCh*    value,
00247             const XMLCh*    uri = 0,
00248             const XMLCh*    localName = 0);
00249 
00250     // Helper function to delete entries...
00251     static void
00252     deleteEntries(AttributesVectorType&     theVector);
00253 
00254     AttributesVectorType    m_attributesVector;
00255 
00256     AttributesVectorType    m_cacheVector;
00257 };
00258 
00259 
00260 
00261 XALAN_CPP_NAMESPACE_END
00262 
00263 
00264 
00265 #endif  // ATTRIBUTESIMPL_HEADER_GUARD_1357924680

Interpreting class diagrams

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

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