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

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

xerces added

Line 
1/*
2 * Copyright 1999-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: XMLAttDefList.hpp,v $
19 * Revision 1.9  2004/09/08 13:55:58  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.8  2004/01/29 11:46:29  cargilld
23 * Code cleanup changes to get rid of various compiler diagnostic messages.
24 *
25 * Revision 1.7  2003/11/10 21:53:54  neilg
26 * add a means of statelessly traversing attribute lists.  mark the enumeration-based means as deprecated, since those are not stateless
27 *
28 * Revision 1.6  2003/10/20 11:47:30  gareth
29 * Constructor take memory manager and get method for it.
30 *
31 * Revision 1.5  2003/10/10 16:23:29  peiyongz
32 * Implementation of Serialization/Deserialization
33 *
34 * Revision 1.4  2003/05/16 21:36:55  knoaman
35 * Memory manager implementation: Modify constructors to pass in the memory manager.
36 *
37 * Revision 1.3  2003/05/15 18:26:07  knoaman
38 * Partial implementation of the configurable memory manager.
39 *
40 * Revision 1.2  2002/11/04 15:00:21  tng
41 * C++ Namespace Support.
42 *
43 * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
44 * sane_include
45 *
46 * Revision 1.4  2000/02/24 20:00:22  abagchi
47 * Swat for removing Log from API docs
48 *
49 * Revision 1.3  2000/02/15 01:21:30  roddey
50 * Some initial documentation improvements. More to come...
51 *
52 * Revision 1.2  2000/02/06 07:47:46  rahulj
53 * Year 2K copyright swat.
54 *
55 * Revision 1.1.1.1  1999/11/09 01:08:28  twl
56 * Initial checkin
57 *
58 * Revision 1.2  1999/11/08 20:44:35  rahul
59 * Swat for adding in Product name and CVS comment log variable.
60 *
61 */
62
63#if !defined(XMLATTDEFLIST_HPP)
64#define XMLATTDEFLIST_HPP
65
66#include <xercesc/util/XercesDefs.hpp>
67#include <xercesc/util/XMemory.hpp>
68#include <xercesc/internal/XSerializable.hpp>
69
70XERCES_CPP_NAMESPACE_BEGIN
71
72class XMLAttDef;
73
74/**
75 *  This class defines an abstract interface that all validators must support.
76 *  When the scanner scans the attributes in a start tag, it must have a list
77 *  of the defined attributes for that element. This is used to fault in
78 *  defaulted and fixed attributes, to know which ones are required, and to
79 *  know the their types in order to do the correct normalization.
80 *
81 *  Since each validator will have its own derivatives of XMLAttDef and will
82 *  have its own specialized storage mechanisms for elements and the att
83 *  defs that they own, there must be an abstracted way for the scanner to
84 *  deal with this list.
85 *
86 *  It does not derive from the generic Enumerator template class, because
87 *  there are portability issues with deriving from a template class in a
88 *  DLL. It does though provide a similar enumerator interface.
89 */
90
91class XMLPARSER_EXPORT XMLAttDefList : public XSerializable, public XMemory
92{
93public:
94    // -----------------------------------------------------------------------
95    //  Constructors and Destructor
96    // -----------------------------------------------------------------------
97
98    /** @name Destructor */
99    //@{
100    virtual ~XMLAttDefList();
101    //@}
102
103
104    // -----------------------------------------------------------------------
105    //  The virtual interface
106    // -----------------------------------------------------------------------
107
108    /**
109     * @deprecated This method is not thread-safe.
110     */
111    virtual bool hasMoreElements() const = 0;
112    virtual bool isEmpty() const = 0;
113    virtual XMLAttDef* findAttDef
114    (
115        const   unsigned long       uriID
116        , const XMLCh* const        attName
117    ) = 0;
118    virtual const XMLAttDef* findAttDef
119    (
120        const   unsigned long       uriID
121        , const XMLCh* const        attName
122    )   const = 0;
123    virtual XMLAttDef* findAttDef
124    (
125        const   XMLCh* const        attURI
126        , const XMLCh* const        attName
127    ) = 0;
128    virtual const XMLAttDef* findAttDef
129    (
130        const   XMLCh* const        attURI
131        , const XMLCh* const        attName
132    )   const = 0;
133
134    /**
135     * @deprecated This method is not thread-safe.
136     */
137    virtual XMLAttDef& nextElement() = 0;
138
139    /**
140     * @deprecated This method is not thread-safe.
141     */
142    virtual void Reset() = 0;
143
144    /**
145     * return total number of attributes in this list
146     */
147    virtual unsigned int getAttDefCount() const = 0;
148
149    /**
150     * return attribute at the index-th position in the list.
151     */
152    virtual XMLAttDef &getAttDef(unsigned int index) = 0;
153
154    /**
155     * return attribute at the index-th position in the list.
156     */
157    virtual const XMLAttDef &getAttDef(unsigned int index) const = 0;
158
159    /***
160     * Support for Serialization/De-serialization
161     ***/
162    DECL_XSERIALIZABLE(XMLAttDefList)
163
164
165    // -----------------------------------------------------------------------
166    //  Getter methods
167    // -----------------------------------------------------------------------
168
169    /** @name Getter methods */
170    //@{
171
172    /** Get the memory manager
173      *
174      * This method returns the configurable memory manager used by the
175      * element declaration for dynamic allocation/deacllocation.
176      *
177      * @return the memory manager
178      */
179    MemoryManager* getMemoryManager() const;
180
181    //@}
182
183protected :
184    // -----------------------------------------------------------------------
185    //  Hidden constructors and operators
186    // -----------------------------------------------------------------------
187    XMLAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
188
189private:
190    // unimplemented
191    XMLAttDefList(const XMLAttDefList&);
192    XMLAttDefList& operator=(const XMLAttDefList&);
193
194    MemoryManager*      fMemoryManager;
195};
196
197
198
199// ---------------------------------------------------------------------------
200//  XMLAttDefList: Getter methods
201// ---------------------------------------------------------------------------
202
203inline MemoryManager* XMLAttDefList::getMemoryManager() const
204{
205    return fMemoryManager;
206}
207
208// ---------------------------------------------------------------------------
209//  XMLAttDefList: Constructors and Destructor
210// ---------------------------------------------------------------------------
211inline XMLAttDefList::~XMLAttDefList()
212{
213}
214
215
216// ---------------------------------------------------------------------------
217//  XMLAttDefList: Protected Constructor
218// ---------------------------------------------------------------------------
219inline XMLAttDefList::XMLAttDefList(MemoryManager* const manager):
220fMemoryManager(manager)
221{
222}
223
224XERCES_CPP_NAMESPACE_END
225
226#endif
Note: See TracBrowser for help on using the repository browser.