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

Revision 358, 6.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: DTDAttDef.hpp,v $
19 * Revision 1.10  2004/09/20 14:47:13  amassari
20 * Mark some methods as deprecated
21 *
22 * Revision 1.9  2004/09/08 13:56:50  peiyongz
23 * Apache License Version 2.0
24 *
25 * Revision 1.8  2004/01/29 11:52:30  cargilld
26 * Code cleanup changes to get rid of various compiler diagnostic messages.
27 *
28 * Revision 1.7  2003/12/17 00:18:40  cargilld
29 * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
30 *
31 * Revision 1.6  2003/10/10 16:24:51  peiyongz
32 * Implementation of Serialization/Deserialization
33 *
34 * Revision 1.5  2003/05/16 21:43:19  knoaman
35 * Memory manager implementation: Modify constructors to pass in the memory manager.
36 *
37 * Revision 1.4  2003/05/15 18:54:50  knoaman
38 * Partial implementation of the configurable memory manager.
39 *
40 * Revision 1.3  2003/01/29 19:46:40  gareth
41 * added DOMTypeInfo API
42 *
43 * Revision 1.2  2002/11/04 14:50:40  tng
44 * C++ Namespace Support.
45 *
46 * Revision 1.1.1.1  2002/02/01 22:22:43  peiyongz
47 * sane_include
48 *
49 * Revision 1.3  2000/02/24 20:16:48  abagchi
50 * Swat for removing Log from API docs
51 *
52 * Revision 1.2  2000/02/09 21:42:37  abagchi
53 * Copyright swat
54 *
55 * Revision 1.1.1.1  1999/11/09 01:03:26  twl
56 * Initial checkin
57 *
58 * Revision 1.2  1999/11/08 20:45:39  rahul
59 * Swat for adding in Product name and CVS comment log variable.
60 *
61 */
62
63#if !defined(DTDATTDEF_HPP)
64#define DTDATTDEF_HPP
65
66#include <xercesc/framework/XMLAttDef.hpp>
67
68XERCES_CPP_NAMESPACE_BEGIN
69
70//
71//  This class is a derivative of the core XMLAttDef class. This class adds
72//  any DTD specific data members and provides DTD specific implementations
73//  of any underlying attribute def virtual methods.
74//
75//  In the DTD we don't do namespaces, so the attribute names are just the
76//  QName literally from the DTD. This is what we return as the full name,
77//  which is what is used to key these in any name keyed collections.
78//
79class VALIDATORS_EXPORT DTDAttDef : public XMLAttDef
80{
81public :
82    // -----------------------------------------------------------------------
83    //  Constructors and Destructors
84    // -----------------------------------------------------------------------
85    DTDAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
86    DTDAttDef
87    (
88        const   XMLCh* const           attName
89        , const XMLAttDef::AttTypes    type = CData
90        , const XMLAttDef::DefAttTypes defType = Implied
91        , MemoryManager* const         manager = XMLPlatformUtils::fgMemoryManager
92    );
93    DTDAttDef
94    (
95        const   XMLCh* const           attName
96        , const XMLCh* const           attValue
97        , const XMLAttDef::AttTypes    type
98        , const XMLAttDef::DefAttTypes defType
99        , const XMLCh* const           enumValues = 0
100        , MemoryManager* const         manager = XMLPlatformUtils::fgMemoryManager
101    );
102    ~DTDAttDef();
103
104
105    // -----------------------------------------------------------------------
106    //  Implementation of the XMLAttDef interface
107    // -----------------------------------------------------------------------
108    virtual const XMLCh* getFullName() const;
109
110    //does nothing currently
111    virtual void reset() {};
112
113    // -----------------------------------------------------------------------
114    //  Getter methods
115    // -----------------------------------------------------------------------
116    unsigned int getElemId() const;
117
118    /**
119     * @deprecated
120    **/
121    virtual const XMLCh* getDOMTypeInfoName() const;
122
123    /**
124     * @deprecated
125    **/
126    virtual const XMLCh* getDOMTypeInfoUri() const;
127
128
129    // -----------------------------------------------------------------------
130    //  Setter methods
131    // -----------------------------------------------------------------------
132    void setElemId(const unsigned int newId);
133    void setName(const XMLCh* const newName);
134
135    /***
136     * Support for Serialization/De-serialization
137     ***/
138    DECL_XSERIALIZABLE(DTDAttDef)
139
140private :
141    // -----------------------------------------------------------------------
142    // Unimplemented constructors and operators
143    // -----------------------------------------------------------------------
144    DTDAttDef(const DTDAttDef &);
145    DTDAttDef& operator = (const  DTDAttDef&);
146
147    // -----------------------------------------------------------------------
148    //  Private data members
149    //
150    //  fElemId
151    //      This is the id of the element (the id is into the element decl
152    //      pool) of the element this attribute def said it belonged to.
153    //      This is used later to link back to the element, mostly for
154    //      validation purposes.
155    //
156    //  fName
157    //      This is the name of the attribute. Since we don't do namespaces
158    //      in the DTD, its just the fully qualified name.
159    // -----------------------------------------------------------------------
160    unsigned int    fElemId;
161    XMLCh*          fName;
162};
163
164
165// ---------------------------------------------------------------------------
166//  DTDAttDef: Implementation of the XMLAttDef interface
167// ---------------------------------------------------------------------------
168inline const XMLCh* DTDAttDef::getFullName() const
169{
170    return fName;
171}
172
173
174// ---------------------------------------------------------------------------
175//  DTDAttDef: Getter methods
176// ---------------------------------------------------------------------------
177inline unsigned int DTDAttDef::getElemId() const
178{
179    return fElemId;
180}
181
182inline const XMLCh* DTDAttDef::getDOMTypeInfoName() const
183{
184    return getAttTypeString(getType(), getMemoryManager());
185}
186
187inline const XMLCh* DTDAttDef::getDOMTypeInfoUri() const
188{
189    return 0;
190}
191
192// ---------------------------------------------------------------------------
193//  DTDAttDef: Setter methods
194// ---------------------------------------------------------------------------
195inline void DTDAttDef::setElemId(const unsigned int newId)
196{
197    fElemId = newId;
198}
199
200
201XERCES_CPP_NAMESPACE_END
202
203#endif
Note: See TracBrowser for help on using the repository browser.