source: NonGTP/Xerces/xerces/include/xercesc/validators/DTD/DTDEntityDecl.hpp @ 358

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

xerces added

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