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

Revision 358, 9.2 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: XMLNotationDecl.hpp,v $
19 * Revision 1.13  2004/09/08 13:55:59  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.12  2004/02/15 19:37:16  amassari
23 * Removed cause for warnings in VC 7.1
24 *
25 * Revision 1.11  2003/11/21 22:34:46  neilg
26 * More schema component model implementation, thanks to David Cargill.
27 * In particular, this cleans up and completes the XSModel, XSNamespaceItem,
28 * XSAttributeDeclaration and XSAttributeGroup implementations.
29 *
30 * Revision 1.10  2003/11/06 15:30:06  neilg
31 * 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.
32 *
33 * Revision 1.9  2003/10/10 16:23:29  peiyongz
34 * Implementation of Serialization/Deserialization
35 *
36 * Revision 1.8  2003/05/22 02:10:51  knoaman
37 * Default the memory manager.
38 *
39 * Revision 1.7  2003/05/16 21:36:55  knoaman
40 * Memory manager implementation: Modify constructors to pass in the memory manager.
41 *
42 * Revision 1.6  2003/05/15 18:26:07  knoaman
43 * Partial implementation of the configurable memory manager.
44 *
45 * Revision 1.5  2003/04/21 20:46:01  knoaman
46 * Use XMLString::release to prepare for configurable memory manager.
47 *
48 * Revision 1.4  2003/03/07 18:08:10  tng
49 * Return a reference instead of void for operator=
50 *
51 * Revision 1.3  2002/11/04 15:00:21  tng
52 * C++ Namespace Support.
53 *
54 * Revision 1.2  2002/08/22 19:27:41  tng
55 * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
56 *
57 * Revision 1.1.1.1  2002/02/01 22:21:52  peiyongz
58 * sane_include
59 *
60 * Revision 1.5  2000/03/02 19:54:25  roddey
61 * This checkin includes many changes done while waiting for the
62 * 1.1.0 code to be finished. I can't list them all here, but a list is
63 * available elsewhere.
64 *
65 * Revision 1.4  2000/02/24 20:00:23  abagchi
66 * Swat for removing Log from API docs
67 *
68 * Revision 1.3  2000/02/15 01:21:31  roddey
69 * Some initial documentation improvements. More to come...
70 *
71 * Revision 1.2  2000/02/06 07:47:48  rahulj
72 * Year 2K copyright swat.
73 *
74 * Revision 1.1.1.1  1999/11/09 01:08:35  twl
75 * Initial checkin
76 *
77 * Revision 1.2  1999/11/08 20:44:39  rahul
78 * Swat for adding in Product name and CVS comment log variable.
79 *
80 */
81
82#if !defined(XMLNOTATIONDECL_HPP)
83#define XMLNOTATIONDECL_HPP
84
85#include <xercesc/util/XMemory.hpp>
86#include <xercesc/util/PlatformUtils.hpp>
87#include <xercesc/util/XMLString.hpp>
88#include <xercesc/internal/XSerializable.hpp>
89
90XERCES_CPP_NAMESPACE_BEGIN
91
92/**
93 *  This class represents the core information about a notation declaration
94 *  that all validators must at least support. Each validator will create a
95 *  derivative of this class which adds any information it requires for its
96 *  own extra needs.
97 *
98 *  At this common level, the information supported is the notation name
99 *  and the public and sysetm ids indicated in the notation declaration.
100 */
101class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
102{
103public:
104    // -----------------------------------------------------------------------
105    //  Constructors and Destructor
106    // -----------------------------------------------------------------------
107
108    /** @name Constructors */
109    //@{
110    XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
111    XMLNotationDecl
112    (
113        const   XMLCh* const    notName
114        , const XMLCh* const    pubId
115        , const XMLCh* const    sysId
116        , const XMLCh* const    baseURI = 0
117        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
118    );
119    //@}
120
121    /** @name Destructor */
122    //@{
123    ~XMLNotationDecl();
124    //@}
125
126
127    // -----------------------------------------------------------------------
128    //  Getter methods
129    // -----------------------------------------------------------------------
130    unsigned int getId() const;
131    const XMLCh* getName() const;
132    const XMLCh* getPublicId() const;
133    const XMLCh* getSystemId() const;
134    const XMLCh* getBaseURI() const;
135    unsigned int getNameSpaceId() const;
136    MemoryManager* getMemoryManager() const;
137
138
139    // -----------------------------------------------------------------------
140    //  Setter methods
141    // -----------------------------------------------------------------------
142    void setId(const unsigned int newId);
143    void setName
144    (
145        const   XMLCh* const    notName
146    );
147    void setPublicId(const XMLCh* const newId);
148    void setSystemId(const XMLCh* const newId);
149    void setBaseURI(const XMLCh* const newId);
150    void setNameSpaceId(const unsigned int newId);
151
152    // -----------------------------------------------------------------------
153    //  Support named collection element semantics
154    // -----------------------------------------------------------------------
155    const XMLCh* getKey() const;
156
157    /***
158     * Support for Serialization/De-serialization
159     ***/
160    DECL_XSERIALIZABLE(XMLNotationDecl)
161
162private :
163    // -----------------------------------------------------------------------
164    //  Unimplemented constructors and operators
165    // -----------------------------------------------------------------------
166    XMLNotationDecl(const XMLNotationDecl&);
167    XMLNotationDecl& operator=(const XMLNotationDecl&);
168
169
170    // -----------------------------------------------------------------------
171    //  XMLNotationDecl: Private helper methods
172    // -----------------------------------------------------------------------
173    void cleanUp();
174
175
176    // -----------------------------------------------------------------------
177    //  Private data members
178    //
179    //  fId
180    //      This is the unique id given to this notation decl.
181    //
182    //  fName
183    //      The notation's name, which identifies the type of notation it
184    //      applies to.
185    //
186    //  fPublicId
187    //      The text of the notation's public id, if any.
188    //
189    //  fSystemId
190    //      The text of the notation's system id, if any.
191    //
192    //  fBaseURI
193    //      The text of the notation's base URI
194    // -----------------------------------------------------------------------
195    unsigned int    fId;
196        XMLCh*          fName;
197    XMLCh*          fPublicId;
198    XMLCh*          fSystemId;
199    XMLCh*          fBaseURI;
200    unsigned int    fNameSpaceId;
201    MemoryManager*  fMemoryManager;
202};
203
204
205// -----------------------------------------------------------------------
206//  Getter methods
207// -----------------------------------------------------------------------
208inline unsigned int XMLNotationDecl::getId() const
209{
210    return fId;
211}
212
213inline const XMLCh* XMLNotationDecl::getName() const
214{
215    return fName;
216}
217
218inline unsigned int XMLNotationDecl::getNameSpaceId() const
219{
220    return fNameSpaceId;
221}
222
223inline const XMLCh* XMLNotationDecl::getPublicId() const
224{
225    return fPublicId;
226}
227
228inline const XMLCh* XMLNotationDecl::getSystemId() const
229{
230    return fSystemId;
231}
232
233inline const XMLCh* XMLNotationDecl::getBaseURI() const
234{
235    return fBaseURI;
236}
237
238inline MemoryManager* XMLNotationDecl::getMemoryManager() const
239{
240    return fMemoryManager;
241}
242
243// -----------------------------------------------------------------------
244//  Setter methods
245// -----------------------------------------------------------------------
246inline void XMLNotationDecl::setId(const unsigned int newId)
247{
248    fId = newId;
249}
250
251inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
252{
253    fNameSpaceId = newId;
254}
255
256inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
257{
258    if (fPublicId)
259        fMemoryManager->deallocate(fPublicId);
260
261    fPublicId = XMLString::replicate(newId, fMemoryManager);
262}
263
264inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
265{
266    if (fSystemId)
267        fMemoryManager->deallocate(fSystemId);
268
269    fSystemId = XMLString::replicate(newId, fMemoryManager);
270}
271
272inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
273{
274    if (fBaseURI)
275        fMemoryManager->deallocate(fBaseURI);
276
277    fBaseURI = XMLString::replicate(newId, fMemoryManager);
278}
279
280
281// ---------------------------------------------------------------------------
282//  XMLNotationDecl: Support named pool element semantics
283// ---------------------------------------------------------------------------
284inline const XMLCh* XMLNotationDecl::getKey() const
285{
286    return fName;
287}
288
289XERCES_CPP_NAMESPACE_END
290
291#endif
Note: See TracBrowser for help on using the repository browser.