Back to home page

EIC code displayed by LXR

 
 

    


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

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_XSNAMEDMAP_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP
0024 
0025 
0026 #include <xercesc/util/XMemory.hpp>
0027 #include <xercesc/util/RefHash2KeysTableOf.hpp>
0028 #include <xercesc/util/RefVectorOf.hpp>
0029 
0030 XERCES_CPP_NAMESPACE_BEGIN
0031 
0032 class XMLStringPool;
0033 
0034 /*
0035  * This template provides convenient mappings between name,namespace
0036  * pairs and individual components, as well as means to iterate through all the
0037  * named components on some object.
0038  */
0039 
0040 template <class TVal> class XSNamedMap: public XMemory
0041 {
0042 public:
0043     // -----------------------------------------------------------------------
0044     //  Constructors and Destructor
0045     // -----------------------------------------------------------------------
0046     /** @name Constructors */
0047     //@{
0048 
0049     XSNamedMap(const XMLSize_t maxElems,
0050         const XMLSize_t modulus,
0051         XMLStringPool* uriStringPool,
0052         const bool adoptElems,
0053         MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0054     );
0055     //@}
0056 
0057     /** @name Destructor */
0058     //@{
0059     ~XSNamedMap();
0060 
0061     //@}
0062 
0063     // -----------------------------------------------------------------------
0064     //  XSNamedMap methods
0065     // -----------------------------------------------------------------------
0066     /** @name XSNamedMap methods */
0067     //@{
0068 
0069     /**
0070      * The number of <code>XSObjects</code> in the <code>XSObjectList</code>.
0071      * The range of valid child object indices is 0 to
0072      * <code>mapLength-1</code> inclusive.
0073      */
0074     XMLSize_t getLength() const;
0075 
0076     /**
0077      *  Returns the <code>index</code>th item in the collection. The index
0078      * starts at 0. If <code>index</code> is greater than or equal to the
0079      * number of objects in the list, this returns <code>null</code>.
0080      * @param index  index into the collection.
0081      * @return  The <code>XSObject</code> at the <code>index</code>th
0082      *   position in the <code>XSObjectList</code>, or <code>null</code> if
0083      *   that is not a valid index.
0084      */
0085     TVal *item(XMLSize_t index);
0086     const TVal *item(XMLSize_t index) const;
0087 
0088     /**
0089      * Retrieves a component specified by local name and namespace URI.
0090      * <br>applications must use the value null as the
0091      * <code>compNamespace</code> parameter for components whose targetNamespace property
0092      * is absent.
0093      * @param compNamespace The namespace URI of the component to retrieve.
0094      * @param localName The local name of the component to retrieve.
0095      * @return A component (of any type) with the specified local
0096      *   name and namespace URI, or <code>null</code> if they do not
0097      *   identify any node in this map.
0098      */
0099     TVal *itemByName(const XMLCh *compNamespace,
0100                               const XMLCh *localName);
0101 
0102     //@}
0103 
0104     //----------------------------------
0105     /** methods needed by implementation */
0106 
0107     //@{
0108     void addElement(TVal* const toAdd, const XMLCh* key1, const XMLCh* key2);
0109     //@}
0110 
0111 
0112 private :
0113     // -----------------------------------------------------------------------
0114     //  Unimplemented constructors and operators
0115     // -----------------------------------------------------------------------
0116     XSNamedMap(const XSNamedMap<TVal>&);
0117     XSNamedMap<TVal>& operator=(const XSNamedMap<TVal>&);
0118 
0119     // -----------------------------------------------------------------------
0120     //  Data members
0121     //
0122     // fMemoryManager
0123     //  manager used to allocate memory needed by this object
0124     MemoryManager *const        fMemoryManager;
0125     XMLStringPool*              fURIStringPool;
0126     RefVectorOf<TVal>*          fVector;
0127     RefHash2KeysTableOf<TVal>*  fHash;
0128 };
0129 
0130 
0131 
0132 XERCES_CPP_NAMESPACE_END
0133 
0134 #if !defined(XERCES_TMPLSINC)
0135 #include <xercesc/framework/psvi/XSNamedMap.c>
0136 #endif
0137 
0138 #endif