source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/validators/DTD/DTDEntityDecl.hpp @ 2674

Revision 2674, 6.7 KB checked in by mattausch, 16 years ago (diff)
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: DTDEntityDecl.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22
23#if !defined(DTDENTITYDECL_HPP)
24#define DTDENTITYDECL_HPP
25
26#include <xercesc/framework/XMLEntityDecl.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30//
31//  This is a derivative of the abstract version of an entity decl in the
32//  framework directory. We just need to provide implementation of a couple
33//  of methods.
34//
35class VALIDATORS_EXPORT DTDEntityDecl : public XMLEntityDecl
36{
37public :
38    // -----------------------------------------------------------------------
39    //  Constructors and Destructor
40    // -----------------------------------------------------------------------
41    DTDEntityDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
42    DTDEntityDecl
43    (
44        const   XMLCh* const   entName
45        , const bool           fromIntSubset = false
46        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
47    );
48    DTDEntityDecl
49    (
50        const   XMLCh* const   entName
51        , const XMLCh* const   value
52        , const bool           fromIntSubset = false
53        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
54    );
55    DTDEntityDecl
56    (
57        const   XMLCh* const    entName
58        , const XMLCh           value
59        , const bool            fromIntSubset = false
60        , const bool            specialChar = false
61    );
62    ~DTDEntityDecl();
63
64
65    // -----------------------------------------------------------------------
66    //  Implementation of the virtual XMLEntityDecl interface
67    // -----------------------------------------------------------------------
68    virtual bool getDeclaredInIntSubset() const;
69    virtual bool getIsParameter() const;
70    virtual bool getIsSpecialChar() const;
71
72
73    // -----------------------------------------------------------------------
74    //  Setter methods
75    // -----------------------------------------------------------------------
76    void setDeclaredInIntSubset(const bool newValue);
77    void setIsParameter(const bool newValue);
78    void setIsSpecialChar(const bool newValue);
79
80    /***
81     * Support for Serialization/De-serialization
82     ***/
83    DECL_XSERIALIZABLE(DTDEntityDecl)
84
85private :
86    // -----------------------------------------------------------------------
87    //  Unimplemented constructors and operators
88    // -----------------------------------------------------------------------
89    DTDEntityDecl(const DTDEntityDecl&);
90    DTDEntityDecl& operator=(DTDEntityDecl&);
91
92
93    // -----------------------------------------------------------------------
94    //  Private data members
95    //
96    //  fDeclaredInIntSubset
97    //      Indicates whether the entity was declared in the internal subset
98    //      or not. If not, it cannot be referred to from a standalone
99    //      document.
100    //
101    //  fIsParameter
102    //      Indicates whether this is a parameter entity or a general entity.
103    //
104    //  fIsSpecialChar
105    //      This indicates that its one of the special character entities,
106    //      e.g. lt or gt or amp. We need to know this because there are
107    //      places where only a numeric char ref or special char ref is valid
108    //      and all others are ignored or illegal.
109    // -----------------------------------------------------------------------
110    bool    fDeclaredInIntSubset;
111    bool    fIsParameter;
112    bool    fIsSpecialChar;
113};
114
115
116// ---------------------------------------------------------------------------
117//  DTDEntityDecl: Constructors and Destructor
118// ---------------------------------------------------------------------------
119inline DTDEntityDecl::DTDEntityDecl(MemoryManager* const manager) :
120
121    XMLEntityDecl(manager)
122    , fDeclaredInIntSubset(false)
123    , fIsParameter(false)
124    , fIsSpecialChar(false)
125{
126}
127
128inline DTDEntityDecl::DTDEntityDecl( const XMLCh* const   entName
129                                   , const bool           fromIntSubset
130                                   , MemoryManager* const manager) :
131
132    XMLEntityDecl(entName, manager)
133    , fDeclaredInIntSubset(fromIntSubset)
134    , fIsParameter(false)
135    , fIsSpecialChar(false)
136{
137}
138
139inline DTDEntityDecl::DTDEntityDecl( const XMLCh* const   entName
140                                   , const XMLCh* const   value
141                                   , const bool           fromIntSubset
142                                   , MemoryManager* const manager) :
143    XMLEntityDecl(entName, value, manager)
144    , fDeclaredInIntSubset(fromIntSubset)
145    , fIsParameter(false)
146    , fIsSpecialChar(false)
147{
148}
149
150inline DTDEntityDecl::DTDEntityDecl(const   XMLCh* const    entName
151                                    , const XMLCh           value
152                                    , const bool            fromIntSubset
153                                    , const bool            specialChar) :
154    XMLEntityDecl(entName, value, XMLPlatformUtils::fgMemoryManager)
155    , fDeclaredInIntSubset(fromIntSubset)
156    , fIsParameter(false)
157    , fIsSpecialChar(specialChar)
158{
159}
160
161inline DTDEntityDecl::~DTDEntityDecl()
162{
163}
164
165
166// ---------------------------------------------------------------------------
167//  DTDEntityDecl: Getter methods
168// ---------------------------------------------------------------------------
169inline bool DTDEntityDecl::getDeclaredInIntSubset() const
170{
171    return fDeclaredInIntSubset;
172}
173
174inline bool DTDEntityDecl::getIsParameter() const
175{
176    return fIsParameter;
177}
178
179inline bool DTDEntityDecl::getIsSpecialChar() const
180{
181    return fIsSpecialChar;
182}
183
184
185// ---------------------------------------------------------------------------
186//  DTDEntityDecl: Setter methods
187// ---------------------------------------------------------------------------
188inline void DTDEntityDecl::setDeclaredInIntSubset(const bool newValue)
189{
190    fDeclaredInIntSubset = newValue;
191}
192
193inline void DTDEntityDecl::setIsParameter(const bool newValue)
194{
195    fIsParameter = newValue;
196}
197
198inline void DTDEntityDecl::setIsSpecialChar(const bool newValue)
199{
200    fIsSpecialChar = newValue;
201}
202
203XERCES_CPP_NAMESPACE_END
204
205#endif
Note: See TracBrowser for help on using the repository browser.