source: NonGTP/Xerces/xercesc/validators/DTD/DTDEntityDecl.hpp @ 188

Revision 188, 9.7 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2000 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: DTDEntityDecl.hpp,v $
59 * Revision 1.5  2003/10/10 16:24:51  peiyongz
60 * Implementation of Serialization/Deserialization
61 *
62 * Revision 1.4  2003/05/16 21:43:19  knoaman
63 * Memory manager implementation: Modify constructors to pass in the memory manager.
64 *
65 * Revision 1.3  2003/03/07 18:17:12  tng
66 * Return a reference instead of void for operator=
67 *
68 * Revision 1.2  2002/11/04 14:50:40  tng
69 * C++ Namespace Support.
70 *
71 * Revision 1.1.1.1  2002/02/01 22:22:43  peiyongz
72 * sane_include
73 *
74 * Revision 1.4  2000/02/24 20:16:49  abagchi
75 * Swat for removing Log from API docs
76 *
77 * Revision 1.3  2000/02/09 21:42:37  abagchi
78 * Copyright swat
79 *
80 * Revision 1.2  2000/01/20 01:57:07  rahulj
81 * Reported by marc@ist.de
82 * Removed extra 'const' qualifiers.
83 *
84 * Revision 1.1.1.1  1999/11/09 01:03:34  twl
85 * Initial checkin
86 *
87 * Revision 1.2  1999/11/08 20:45:40  rahul
88 * Swat for adding in Product name and CVS comment log variable.
89 *
90 */
91
92
93#if !defined(DTDENTITYDECL_HPP)
94#define DTDENTITYDECL_HPP
95
96#include <xercesc/framework/XMLEntityDecl.hpp>
97
98XERCES_CPP_NAMESPACE_BEGIN
99
100//
101//  This is a derivative of the abstract version of an entity decl in the
102//  framework directory. We just need to provide implementation of a couple
103//  of methods.
104//
105class VALIDATORS_EXPORT DTDEntityDecl : public XMLEntityDecl
106{
107public :
108    // -----------------------------------------------------------------------
109    //  Constructors and Destructor
110    // -----------------------------------------------------------------------
111    DTDEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
112    DTDEntityDecl
113    (
114        const   XMLCh* const   entName
115        , const bool           fromIntSubset = false
116        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
117    );
118    DTDEntityDecl
119    (
120        const   XMLCh* const   entName
121        , const XMLCh* const   value
122        , const bool           fromIntSubset = false
123        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
124    );
125    DTDEntityDecl
126    (
127        const   XMLCh* const    entName
128        , const XMLCh           value
129        , const bool            fromIntSubset = false
130        , const bool            specialChar = false
131    );
132    ~DTDEntityDecl();
133
134
135    // -----------------------------------------------------------------------
136    //  Implementation of the virtual XMLEntityDecl interface
137    // -----------------------------------------------------------------------
138    virtual bool getDeclaredInIntSubset() const;
139    virtual bool getIsParameter() const;
140    virtual bool getIsSpecialChar() const;
141
142
143    // -----------------------------------------------------------------------
144    //  Setter methods
145    // -----------------------------------------------------------------------
146    void setDeclaredInIntSubset(const bool newValue);
147    void setIsParameter(const bool newValue);
148    void setIsSpecialChar(const bool newValue);
149
150    /***
151     * Support for Serialization/De-serialization
152     ***/
153    DECL_XSERIALIZABLE(DTDEntityDecl)
154
155private :
156    // -----------------------------------------------------------------------
157    //  Unimplemented constructors and operators
158    // -----------------------------------------------------------------------
159    DTDEntityDecl(const DTDEntityDecl&);
160    DTDEntityDecl& operator=(DTDEntityDecl&);
161
162
163    // -----------------------------------------------------------------------
164    //  Private data members
165    //
166    //  fDeclaredInIntSubset
167    //      Indicates whether the entity was declared in the internal subset
168    //      or not. If not, it cannot be referred to from a standalone
169    //      document.
170    //
171    //  fIsParameter
172    //      Indicates whether this is a parameter entity or a general entity.
173    //
174    //  fIsSpecialChar
175    //      This indicates that its one of the special character entities,
176    //      e.g. lt or gt or amp. We need to know this because there are
177    //      places where only a numeric char ref or special char ref is valid
178    //      and all others are ignored or illegal.
179    // -----------------------------------------------------------------------
180    bool    fDeclaredInIntSubset;
181    bool    fIsParameter;
182    bool    fIsSpecialChar;
183};
184
185
186// ---------------------------------------------------------------------------
187//  DTDEntityDecl: Constructors and Destructor
188// ---------------------------------------------------------------------------
189inline DTDEntityDecl::DTDEntityDecl(MemoryManager* const manager) :
190
191    XMLEntityDecl(manager)
192    , fDeclaredInIntSubset(false)
193    , fIsParameter(false)
194    , fIsSpecialChar(false)
195{
196}
197
198inline DTDEntityDecl::DTDEntityDecl( const XMLCh* const   entName
199                                   , const bool           fromIntSubset
200                                   , MemoryManager* const manager) :
201
202    XMLEntityDecl(entName, manager)
203    , fDeclaredInIntSubset(fromIntSubset)
204    , fIsParameter(false)
205    , fIsSpecialChar(false)
206{
207}
208
209inline DTDEntityDecl::DTDEntityDecl( const XMLCh* const   entName
210                                   , const XMLCh* const   value
211                                   , const bool           fromIntSubset
212                                   , MemoryManager* const manager) :
213    XMLEntityDecl(entName, value, manager)
214    , fDeclaredInIntSubset(fromIntSubset)
215    , fIsParameter(false)
216    , fIsSpecialChar(false)
217{
218}
219
220inline DTDEntityDecl::DTDEntityDecl(const   XMLCh* const    entName
221                                    , const XMLCh           value
222                                    , const bool            fromIntSubset
223                                    , const bool            specialChar) :
224    XMLEntityDecl(entName, value, XMLPlatformUtils::fgMemoryManager)
225    , fDeclaredInIntSubset(fromIntSubset)
226    , fIsParameter(false)
227    , fIsSpecialChar(specialChar)
228{
229}
230
231inline DTDEntityDecl::~DTDEntityDecl()
232{
233}
234
235
236// ---------------------------------------------------------------------------
237//  DTDEntityDecl: Getter methods
238// ---------------------------------------------------------------------------
239inline bool DTDEntityDecl::getDeclaredInIntSubset() const
240{
241    return fDeclaredInIntSubset;
242}
243
244inline bool DTDEntityDecl::getIsParameter() const
245{
246    return fIsParameter;
247}
248
249inline bool DTDEntityDecl::getIsSpecialChar() const
250{
251    return fIsSpecialChar;
252}
253
254
255// ---------------------------------------------------------------------------
256//  DTDEntityDecl: Setter methods
257// ---------------------------------------------------------------------------
258inline void DTDEntityDecl::setDeclaredInIntSubset(const bool newValue)
259{
260    fDeclaredInIntSubset = newValue;
261}
262
263inline void DTDEntityDecl::setIsParameter(const bool newValue)
264{
265    fIsParameter = newValue;
266}
267
268inline void DTDEntityDecl::setIsSpecialChar(const bool newValue)
269{
270    fIsSpecialChar = newValue;
271}
272
273XERCES_CPP_NAMESPACE_END
274
275#endif
Note: See TracBrowser for help on using the repository browser.