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 568078 2007-08-21 11:43:25Z amassari $
00020  */
00021 
00022 
00023 #if !defined(XSNAMEDMAP_HPP)
00024 #define XSNAMEDMAP_HPP
00025 
00026 
00027 #include <xercesc/util/XMemory.hpp>
00028 #include <xercesc/util/RefHash2KeysTableOf.hpp>
00029 #include <xercesc/util/RefVectorOf.hpp>
00030 
00031 XERCES_CPP_NAMESPACE_BEGIN
00032 
00033 class XMLStringPool;
00034 
00035 /*
00036  * This template provides convenient mappings between name,namespace
00037  * pairs and individual components, as well as means to iterate through all the 
00038  * named components on some object.
00039  */
00040 
00041 template <class TVal> class XSNamedMap: public XMemory
00042 {
00043 public:
00044     // -----------------------------------------------------------------------
00045     //  Constructors and Destructor
00046     // -----------------------------------------------------------------------
00049 
00050     XSNamedMap(const unsigned int maxElems,
00051         const unsigned int modulus,
00052         XMLStringPool* uriStringPool,
00053         const bool adoptElems,
00054         MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00055     );
00057 
00060     ~XSNamedMap();
00061 
00063 
00064     // -----------------------------------------------------------------------
00065     //  XSNamedMap methods
00066     // -----------------------------------------------------------------------
00069 
00075     unsigned int getLength();
00076 
00086     TVal *item(unsigned int index);
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

Generated on Thu Feb 19 11:35:44 2009 for Xerces-C++ by  doxygen 1.5.4