1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
---|
5 | * reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | *
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | *
|
---|
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer in
|
---|
16 | * the documentation and/or other materials provided with the
|
---|
17 | * distribution.
|
---|
18 | *
|
---|
19 | * 3. The end-user documentation included with the redistribution,
|
---|
20 | * if any, must include the following acknowledgment:
|
---|
21 | * "This product includes software developed by the
|
---|
22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
25 | *
|
---|
26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
27 | * not be used to endorse or promote products derived from this
|
---|
28 | * software without prior written permission. For written
|
---|
29 | * permission, please contact apache\@apache.org.
|
---|
30 | *
|
---|
31 | * 5. Products derived from this software may not be called "Apache",
|
---|
32 | * nor may "Apache" appear in their name, without prior written
|
---|
33 | * permission of the Apache Software Foundation.
|
---|
34 | *
|
---|
35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
46 | * SUCH DAMAGE.
|
---|
47 | * ====================================================================
|
---|
48 | *
|
---|
49 | * This software consists of voluntary contributions made by many
|
---|
50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
51 | * originally based on software copyright (c) 1999, International
|
---|
52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
53 | * on the Apache Software Foundation, please see
|
---|
54 | * <http://www.apache.org/>.
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * $Log: XMLAttDefList.hpp,v $
|
---|
59 | * Revision 1.8 2004/01/29 11:46:29 cargilld
|
---|
60 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
61 | *
|
---|
62 | * Revision 1.7 2003/11/10 21:53:54 neilg
|
---|
63 | * add a means of statelessly traversing attribute lists. mark the enumeration-based means as deprecated, since those are not stateless
|
---|
64 | *
|
---|
65 | * Revision 1.6 2003/10/20 11:47:30 gareth
|
---|
66 | * Constructor take memory manager and get method for it.
|
---|
67 | *
|
---|
68 | * Revision 1.5 2003/10/10 16:23:29 peiyongz
|
---|
69 | * Implementation of Serialization/Deserialization
|
---|
70 | *
|
---|
71 | * Revision 1.4 2003/05/16 21:36:55 knoaman
|
---|
72 | * Memory manager implementation: Modify constructors to pass in the memory manager.
|
---|
73 | *
|
---|
74 | * Revision 1.3 2003/05/15 18:26:07 knoaman
|
---|
75 | * Partial implementation of the configurable memory manager.
|
---|
76 | *
|
---|
77 | * Revision 1.2 2002/11/04 15:00:21 tng
|
---|
78 | * C++ Namespace Support.
|
---|
79 | *
|
---|
80 | * Revision 1.1.1.1 2002/02/01 22:21:50 peiyongz
|
---|
81 | * sane_include
|
---|
82 | *
|
---|
83 | * Revision 1.4 2000/02/24 20:00:22 abagchi
|
---|
84 | * Swat for removing Log from API docs
|
---|
85 | *
|
---|
86 | * Revision 1.3 2000/02/15 01:21:30 roddey
|
---|
87 | * Some initial documentation improvements. More to come...
|
---|
88 | *
|
---|
89 | * Revision 1.2 2000/02/06 07:47:46 rahulj
|
---|
90 | * Year 2K copyright swat.
|
---|
91 | *
|
---|
92 | * Revision 1.1.1.1 1999/11/09 01:08:28 twl
|
---|
93 | * Initial checkin
|
---|
94 | *
|
---|
95 | * Revision 1.2 1999/11/08 20:44:35 rahul
|
---|
96 | * Swat for adding in Product name and CVS comment log variable.
|
---|
97 | *
|
---|
98 | */
|
---|
99 |
|
---|
100 | #if !defined(XMLATTDEFLIST_HPP)
|
---|
101 | #define XMLATTDEFLIST_HPP
|
---|
102 |
|
---|
103 | #include <xercesc/util/XercesDefs.hpp>
|
---|
104 | #include <xercesc/util/XMemory.hpp>
|
---|
105 | #include <xercesc/internal/XSerializable.hpp>
|
---|
106 |
|
---|
107 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
108 |
|
---|
109 | class XMLAttDef;
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * This class defines an abstract interface that all validators must support.
|
---|
113 | * When the scanner scans the attributes in a start tag, it must have a list
|
---|
114 | * of the defined attributes for that element. This is used to fault in
|
---|
115 | * defaulted and fixed attributes, to know which ones are required, and to
|
---|
116 | * know the their types in order to do the correct normalization.
|
---|
117 | *
|
---|
118 | * Since each validator will have its own derivatives of XMLAttDef and will
|
---|
119 | * have its own specialized storage mechanisms for elements and the att
|
---|
120 | * defs that they own, there must be an abstracted way for the scanner to
|
---|
121 | * deal with this list.
|
---|
122 | *
|
---|
123 | * It does not derive from the generic Enumerator template class, because
|
---|
124 | * there are portability issues with deriving from a template class in a
|
---|
125 | * DLL. It does though provide a similar enumerator interface.
|
---|
126 | */
|
---|
127 |
|
---|
128 | class XMLPARSER_EXPORT XMLAttDefList : public XSerializable, public XMemory
|
---|
129 | {
|
---|
130 | public:
|
---|
131 | // -----------------------------------------------------------------------
|
---|
132 | // Constructors and Destructor
|
---|
133 | // -----------------------------------------------------------------------
|
---|
134 |
|
---|
135 | /** @name Destructor */
|
---|
136 | //@{
|
---|
137 | virtual ~XMLAttDefList();
|
---|
138 | //@}
|
---|
139 |
|
---|
140 |
|
---|
141 | // -----------------------------------------------------------------------
|
---|
142 | // The virtual interface
|
---|
143 | // -----------------------------------------------------------------------
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * @deprecated This method is not thread-safe.
|
---|
147 | */
|
---|
148 | virtual bool hasMoreElements() const = 0;
|
---|
149 | virtual bool isEmpty() const = 0;
|
---|
150 | virtual XMLAttDef* findAttDef
|
---|
151 | (
|
---|
152 | const unsigned long uriID
|
---|
153 | , const XMLCh* const attName
|
---|
154 | ) = 0;
|
---|
155 | virtual const XMLAttDef* findAttDef
|
---|
156 | (
|
---|
157 | const unsigned long uriID
|
---|
158 | , const XMLCh* const attName
|
---|
159 | ) const = 0;
|
---|
160 | virtual XMLAttDef* findAttDef
|
---|
161 | (
|
---|
162 | const XMLCh* const attURI
|
---|
163 | , const XMLCh* const attName
|
---|
164 | ) = 0;
|
---|
165 | virtual const XMLAttDef* findAttDef
|
---|
166 | (
|
---|
167 | const XMLCh* const attURI
|
---|
168 | , const XMLCh* const attName
|
---|
169 | ) const = 0;
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * @deprecated This method is not thread-safe.
|
---|
173 | */
|
---|
174 | virtual XMLAttDef& nextElement() = 0;
|
---|
175 |
|
---|
176 | /**
|
---|
177 | * @deprecated This method is not thread-safe.
|
---|
178 | */
|
---|
179 | virtual void Reset() = 0;
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * return total number of attributes in this list
|
---|
183 | */
|
---|
184 | virtual unsigned int getAttDefCount() const = 0;
|
---|
185 |
|
---|
186 | /**
|
---|
187 | * return attribute at the index-th position in the list.
|
---|
188 | */
|
---|
189 | virtual XMLAttDef &getAttDef(unsigned int index) = 0;
|
---|
190 |
|
---|
191 | /**
|
---|
192 | * return attribute at the index-th position in the list.
|
---|
193 | */
|
---|
194 | virtual const XMLAttDef &getAttDef(unsigned int index) const = 0;
|
---|
195 |
|
---|
196 | /***
|
---|
197 | * Support for Serialization/De-serialization
|
---|
198 | ***/
|
---|
199 | DECL_XSERIALIZABLE(XMLAttDefList)
|
---|
200 |
|
---|
201 |
|
---|
202 | // -----------------------------------------------------------------------
|
---|
203 | // Getter methods
|
---|
204 | // -----------------------------------------------------------------------
|
---|
205 |
|
---|
206 | /** @name Getter methods */
|
---|
207 | //@{
|
---|
208 |
|
---|
209 | /** Get the memory manager
|
---|
210 | *
|
---|
211 | * This method returns the configurable memory manager used by the
|
---|
212 | * element declaration for dynamic allocation/deacllocation.
|
---|
213 | *
|
---|
214 | * @return the memory manager
|
---|
215 | */
|
---|
216 | MemoryManager* getMemoryManager() const;
|
---|
217 |
|
---|
218 | //@}
|
---|
219 |
|
---|
220 | protected :
|
---|
221 | // -----------------------------------------------------------------------
|
---|
222 | // Hidden constructors and operators
|
---|
223 | // -----------------------------------------------------------------------
|
---|
224 | XMLAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
225 |
|
---|
226 | private:
|
---|
227 | // unimplemented
|
---|
228 | XMLAttDefList(const XMLAttDefList&);
|
---|
229 | XMLAttDefList& operator=(const XMLAttDefList&);
|
---|
230 |
|
---|
231 | MemoryManager* fMemoryManager;
|
---|
232 | };
|
---|
233 |
|
---|
234 |
|
---|
235 |
|
---|
236 | // ---------------------------------------------------------------------------
|
---|
237 | // XMLAttDefList: Getter methods
|
---|
238 | // ---------------------------------------------------------------------------
|
---|
239 |
|
---|
240 | inline MemoryManager* XMLAttDefList::getMemoryManager() const
|
---|
241 | {
|
---|
242 | return fMemoryManager;
|
---|
243 | }
|
---|
244 |
|
---|
245 | // ---------------------------------------------------------------------------
|
---|
246 | // XMLAttDefList: Constructors and Destructor
|
---|
247 | // ---------------------------------------------------------------------------
|
---|
248 | inline XMLAttDefList::~XMLAttDefList()
|
---|
249 | {
|
---|
250 | }
|
---|
251 |
|
---|
252 |
|
---|
253 | // ---------------------------------------------------------------------------
|
---|
254 | // XMLAttDefList: Protected Constructor
|
---|
255 | // ---------------------------------------------------------------------------
|
---|
256 | inline XMLAttDefList::XMLAttDefList(MemoryManager* const manager):
|
---|
257 | fMemoryManager(manager)
|
---|
258 | {
|
---|
259 | }
|
---|
260 |
|
---|
261 | XERCES_CPP_NAMESPACE_END
|
---|
262 |
|
---|
263 | #endif
|
---|