Xerces-C++: XSNamedMap.hpp Source File

- Main Page
- Classes
- Files
- Related Pages

# XSNamedMap.hpp

Go to the documentation of this file.

    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: XSNamedMap.hpp 674012 2008-07-04 11:18:21Z borisk $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_XSNAMEDMAP_HPP
    00024
    00025
    00026 #include <xercesc/util/XMemory.hpp>
    00027 #include <xercesc/util/RefHash2KeysTableOf.hpp>
    00028 #include <xercesc/util/RefVectorOf.hpp>
    00029
    00030 XERCES_CPP_NAMESPACE_BEGIN
    00031
    00032 class XMLStringPool;
    00033
    00034 /*
    00035  * This template provides convenient mappings between name,namespace
    00036  * pairs and individual components, as well as means to iterate through all the
    00037  * named components on some object.
    00038  */
    00039
    00040 template <class TVal> class XSNamedMap: public XMemory
    00041 {
    00042 public:
    00043     // -----------------------------------------------------------------------
    00044     //  Constructors and Destructor
    00045     // -----------------------------------------------------------------------
    00048
    00049     XSNamedMap(const XMLSize_t maxElems,
    00050         const XMLSize_t modulus,
    00051         XMLStringPool* uriStringPool,
    00052         const bool adoptElems,
    00053         MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00054     );
    00056
    00059     ~XSNamedMap();
    00060
    00062
    00063     // -----------------------------------------------------------------------
    00064     //  XSNamedMap methods
    00065     // -----------------------------------------------------------------------
    00068
    00074     XMLSize_t getLength() const;
    00075
    00085     TVal *item(XMLSize_t index);
    00086     const TVal *item(XMLSize_t index) const;
    00087
    00099     TVal *itemByName(const XMLCh *compNamespace,
    00100                               const XMLCh *localName);
    00101
    00103
    00104     //----------------------------------
    00108     void addElement(TVal* const toAdd, const XMLCh* key1, const XMLCh* key2);
    00110
    00111
    00112 private :
    00113     // -----------------------------------------------------------------------
    00114     //  Unimplemented constructors and operators
    00115     // -----------------------------------------------------------------------
    00116     XSNamedMap(const XSNamedMap<TVal>&);
    00117     XSNamedMap<TVal>& operator=(const XSNamedMap<TVal>&);
    00118
    00119     // -----------------------------------------------------------------------
    00120     //  Data members
    00121     //
    00122     // fMemoryManager
    00123     //  manager used to allocate memory needed by this object
    00124     MemoryManager *const        fMemoryManager;
    00125     XMLStringPool*              fURIStringPool;
    00126     RefVectorOf<TVal>*          fVector;
    00127     RefHash2KeysTableOf<TVal>*  fHash;
    00128 };
    00129
    00130
    00131
    00132 XERCES_CPP_NAMESPACE_END
    00133
    00134 #if !defined(XERCES_TMPLSINC)
    00135 #include <xercesc/framework/psvi/XSNamedMap.c>
    00136 #endif
    00137
    00138 #endif