source: NonGTP/Xerces/xerces/include/xercesc/framework/psvi/XSNamedMap.hpp @ 358

Revision 358, 5.1 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2003,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: XSNamedMap.hpp,v $
19 * Revision 1.4  2004/09/08 13:56:09  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.3  2004/01/29 11:46:30  cargilld
23 * Code cleanup changes to get rid of various compiler diagnostic messages.
24 *
25 * Revision 1.2  2003/11/06 15:30:04  neilg
26 * first part of PSVI/schema component model implementation, thanks to David Cargill.  This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
27 *
28 * Revision 1.1  2003/09/16 14:33:36  neilg
29 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
30 *
31 */
32
33
34#if !defined(XSNAMEDMAP_HPP)
35#define XSNAMEDMAP_HPP
36
37
38#include <xercesc/util/XMemory.hpp>
39#include <xercesc/util/RefHash2KeysTableOf.hpp>
40
41XERCES_CPP_NAMESPACE_BEGIN
42
43class XMLStringPool;
44
45/*
46 * This template provides convenient mappings between name,namespace
47 * pairs and individual components, as well as means to iterate through all the
48 * named components on some object.
49 */
50
51template <class TVal> class XSNamedMap: public XMemory
52{
53public:
54    // -----------------------------------------------------------------------
55    //  Constructors and Destructor
56    // -----------------------------------------------------------------------
57    /** @name Constructors */
58    //@{
59
60    XSNamedMap(const unsigned int maxElems,
61        const unsigned int modulus,
62        XMLStringPool* uriStringPool,
63        const bool adoptElems,
64        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
65    );
66    //@}
67
68    /** @name Destructor */
69    //@{
70    ~XSNamedMap();
71
72    //@}
73
74    // -----------------------------------------------------------------------
75    //  XSNamedMap methods
76    // -----------------------------------------------------------------------
77    /** @name XSNamedMap methods */
78    //@{
79
80    /**
81     * The number of <code>XSObjects</code> in the <code>XSObjectList</code>.
82     * The range of valid child object indices is 0 to
83     * <code>mapLength-1</code> inclusive.
84     */
85    unsigned int getLength();
86
87    /**
88     *  Returns the <code>index</code>th item in the collection. The index
89     * starts at 0. If <code>index</code> is greater than or equal to the
90     * number of objects in the list, this returns <code>null</code>.
91     * @param index  index into the collection.
92     * @return  The <code>XSObject</code> at the <code>index</code>th
93     *   position in the <code>XSObjectList</code>, or <code>null</code> if
94     *   that is not a valid index.
95     */
96    TVal *item(unsigned int index);
97
98    /**
99     * Retrieves a component specified by local name and namespace URI.
100     * <br>applications must use the value null as the
101     * <code>compNamespace</code> parameter for components whose targetNamespace property
102     * is absent.
103     * @param compNamespace The namespace URI of the component to retrieve.
104     * @param localName The local name of the component to retrieve.
105     * @return A component (of any type) with the specified local
106     *   name and namespace URI, or <code>null</code> if they do not
107     *   identify any node in this map.
108     */
109    TVal *itemByName(const XMLCh *compNamespace,
110                              const XMLCh *localName);
111
112    //@}
113
114    //----------------------------------
115    /** methods needed by implementation */
116
117    //@{
118    void addElement(TVal* const toAdd, const XMLCh* key1, const XMLCh* key2);
119    //@}
120   
121
122private :
123    // -----------------------------------------------------------------------
124    //  Unimplemented constructors and operators
125    // -----------------------------------------------------------------------
126    XSNamedMap(const XSNamedMap<TVal>&);
127    XSNamedMap<TVal>& operator=(const XSNamedMap<TVal>&);
128
129    // -----------------------------------------------------------------------
130    //  Data members
131    //
132    // fMemoryManager
133    //  manager used to allocate memory needed by this object
134    MemoryManager *const        fMemoryManager;
135    XMLStringPool*              fURIStringPool;
136    RefVectorOf<TVal>*          fVector;
137    RefHash2KeysTableOf<TVal>*  fHash;
138};
139
140
141
142XERCES_CPP_NAMESPACE_END
143
144#if !defined(XERCES_TMPLSINC)
145#include <xercesc/framework/psvi/XSNamedMap.c>
146#endif
147
148#endif
Note: See TracBrowser for help on using the repository browser.