source: icXML/icXML-devel/src/xercesc/framework/XMLNotationDecl.hpp @ 2732

Last change on this file since 2732 was 2722, checked in by cameron, 7 years ago

Original Xerces files with import mods for icxercesc

File size: 6.9 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: XMLNotationDecl.hpp 676911 2008-07-15 13:27:32Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP
24
25#include <xercesc/util/XMemory.hpp>
26#include <icxercesc/util/PlatformUtils.hpp>
27#include <icxercesc/util/XMLString.hpp>
28#include <xercesc/internal/XSerializable.hpp>
29
30XERCES_CPP_NAMESPACE_BEGIN
31
32/**
33 *  This class represents the core information about a notation declaration
34 *  that all validators must at least support. Each validator will create a
35 *  derivative of this class which adds any information it requires for its
36 *  own extra needs.
37 *
38 *  At this common level, the information supported is the notation name
39 *  and the public and sysetm ids indicated in the notation declaration.
40 */
41class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
42{
43public:
44    // -----------------------------------------------------------------------
45    //  Constructors and Destructor
46    // -----------------------------------------------------------------------
47
48    /** @name Constructors */
49    //@{
50    XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
51    XMLNotationDecl
52    (
53        const   XMLCh* const    notName
54        , const XMLCh* const    pubId
55        , const XMLCh* const    sysId
56        , const XMLCh* const    baseURI = 0
57        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
58    );
59    //@}
60
61    /** @name Destructor */
62    //@{
63    ~XMLNotationDecl();
64    //@}
65
66
67    // -----------------------------------------------------------------------
68    //  Getter methods
69    // -----------------------------------------------------------------------
70    XMLSize_t getId() const;
71    const XMLCh* getName() const;
72    const XMLCh* getPublicId() const;
73    const XMLCh* getSystemId() const;
74    const XMLCh* getBaseURI() const;
75    unsigned int getNameSpaceId() const;
76    MemoryManager* getMemoryManager() const;
77
78
79    // -----------------------------------------------------------------------
80    //  Setter methods
81    // -----------------------------------------------------------------------
82    void setId(const XMLSize_t newId);
83    void setName
84    (
85        const   XMLCh* const    notName
86    );
87    void setPublicId(const XMLCh* const newId);
88    void setSystemId(const XMLCh* const newId);
89    void setBaseURI(const XMLCh* const newId);
90    void setNameSpaceId(const unsigned int newId);
91
92    // -----------------------------------------------------------------------
93    //  Support named collection element semantics
94    // -----------------------------------------------------------------------
95    const XMLCh* getKey() const;
96
97    /***
98     * Support for Serialization/De-serialization
99     ***/
100    DECL_XSERIALIZABLE(XMLNotationDecl)
101
102private :
103    // -----------------------------------------------------------------------
104    //  Unimplemented constructors and operators
105    // -----------------------------------------------------------------------
106    XMLNotationDecl(const XMLNotationDecl&);
107    XMLNotationDecl& operator=(const XMLNotationDecl&);
108
109
110    // -----------------------------------------------------------------------
111    //  XMLNotationDecl: Private helper methods
112    // -----------------------------------------------------------------------
113    void cleanUp();
114
115
116    // -----------------------------------------------------------------------
117    //  Private data members
118    //
119    //  fId
120    //      This is the unique id given to this notation decl.
121    //
122    //  fName
123    //      The notation's name, which identifies the type of notation it
124    //      applies to.
125    //
126    //  fPublicId
127    //      The text of the notation's public id, if any.
128    //
129    //  fSystemId
130    //      The text of the notation's system id, if any.
131    //
132    //  fBaseURI
133    //      The text of the notation's base URI
134    // -----------------------------------------------------------------------
135    XMLSize_t       fId;
136    unsigned int    fNameSpaceId;
137        XMLCh*          fName;
138    XMLCh*          fPublicId;
139    XMLCh*          fSystemId;
140    XMLCh*          fBaseURI;
141    MemoryManager*  fMemoryManager;
142};
143
144
145// -----------------------------------------------------------------------
146//  Getter methods
147// -----------------------------------------------------------------------
148inline XMLSize_t XMLNotationDecl::getId() const
149{
150    return fId;
151}
152
153inline const XMLCh* XMLNotationDecl::getName() const
154{
155    return fName;
156}
157
158inline unsigned int XMLNotationDecl::getNameSpaceId() const
159{
160    return fNameSpaceId;
161}
162
163inline const XMLCh* XMLNotationDecl::getPublicId() const
164{
165    return fPublicId;
166}
167
168inline const XMLCh* XMLNotationDecl::getSystemId() const
169{
170    return fSystemId;
171}
172
173inline const XMLCh* XMLNotationDecl::getBaseURI() const
174{
175    return fBaseURI;
176}
177
178inline MemoryManager* XMLNotationDecl::getMemoryManager() const
179{
180    return fMemoryManager;
181}
182
183// -----------------------------------------------------------------------
184//  Setter methods
185// -----------------------------------------------------------------------
186inline void XMLNotationDecl::setId(const XMLSize_t newId)
187{
188    fId = newId;
189}
190
191inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
192{
193    fNameSpaceId = newId;
194}
195
196inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
197{
198    if (fPublicId)
199        fMemoryManager->deallocate(fPublicId);
200
201    fPublicId = XMLString::replicate(newId, fMemoryManager);
202}
203
204inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
205{
206    if (fSystemId)
207        fMemoryManager->deallocate(fSystemId);
208
209    fSystemId = XMLString::replicate(newId, fMemoryManager);
210}
211
212inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
213{
214    if (fBaseURI)
215        fMemoryManager->deallocate(fBaseURI);
216
217    fBaseURI = XMLString::replicate(newId, fMemoryManager);
218}
219
220
221// ---------------------------------------------------------------------------
222//  XMLNotationDecl: Support named pool element semantics
223// ---------------------------------------------------------------------------
224inline const XMLCh* XMLNotationDecl::getKey() const
225{
226    return fName;
227}
228
229XERCES_CPP_NAMESPACE_END
230
231#endif
Note: See TracBrowser for help on using the repository browser.