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: DTDAttDef.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | #if !defined(DTDATTDEF_HPP) |
---|
23 | #define DTDATTDEF_HPP |
---|
24 | |
---|
25 | #include <xercesc/framework/XMLAttDef.hpp> |
---|
26 | |
---|
27 | XERCES_CPP_NAMESPACE_BEGIN |
---|
28 | |
---|
29 | // |
---|
30 | // This class is a derivative of the core XMLAttDef class. This class adds |
---|
31 | // any DTD specific data members and provides DTD specific implementations |
---|
32 | // of any underlying attribute def virtual methods. |
---|
33 | // |
---|
34 | // In the DTD we don't do namespaces, so the attribute names are just the |
---|
35 | // QName literally from the DTD. This is what we return as the full name, |
---|
36 | // which is what is used to key these in any name keyed collections. |
---|
37 | // |
---|
38 | class VALIDATORS_EXPORT DTDAttDef : public XMLAttDef |
---|
39 | { |
---|
40 | public : |
---|
41 | // ----------------------------------------------------------------------- |
---|
42 | // Constructors and Destructors |
---|
43 | // ----------------------------------------------------------------------- |
---|
44 | DTDAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
45 | DTDAttDef |
---|
46 | ( |
---|
47 | const XMLCh* const attName |
---|
48 | , const XMLAttDef::AttTypes type = CData |
---|
49 | , const XMLAttDef::DefAttTypes defType = Implied |
---|
50 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
51 | ); |
---|
52 | DTDAttDef |
---|
53 | ( |
---|
54 | const XMLCh* const attName |
---|
55 | , const XMLCh* const attValue |
---|
56 | , const XMLAttDef::AttTypes type |
---|
57 | , const XMLAttDef::DefAttTypes defType |
---|
58 | , const XMLCh* const enumValues = 0 |
---|
59 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
60 | ); |
---|
61 | ~DTDAttDef(); |
---|
62 | |
---|
63 | |
---|
64 | // ----------------------------------------------------------------------- |
---|
65 | // Implementation of the XMLAttDef interface |
---|
66 | // ----------------------------------------------------------------------- |
---|
67 | virtual const XMLCh* getFullName() const; |
---|
68 | |
---|
69 | //does nothing currently |
---|
70 | virtual void reset() {}; |
---|
71 | |
---|
72 | // ----------------------------------------------------------------------- |
---|
73 | // Getter methods |
---|
74 | // ----------------------------------------------------------------------- |
---|
75 | unsigned int getElemId() const; |
---|
76 | |
---|
77 | /** |
---|
78 | * @deprecated |
---|
79 | **/ |
---|
80 | virtual const XMLCh* getDOMTypeInfoName() const; |
---|
81 | |
---|
82 | /** |
---|
83 | * @deprecated |
---|
84 | **/ |
---|
85 | virtual const XMLCh* getDOMTypeInfoUri() const; |
---|
86 | |
---|
87 | |
---|
88 | // ----------------------------------------------------------------------- |
---|
89 | // Setter methods |
---|
90 | // ----------------------------------------------------------------------- |
---|
91 | void setElemId(const unsigned int newId); |
---|
92 | void setName(const XMLCh* const newName); |
---|
93 | |
---|
94 | /*** |
---|
95 | * Support for Serialization/De-serialization |
---|
96 | ***/ |
---|
97 | DECL_XSERIALIZABLE(DTDAttDef) |
---|
98 | |
---|
99 | private : |
---|
100 | // ----------------------------------------------------------------------- |
---|
101 | // Unimplemented constructors and operators |
---|
102 | // ----------------------------------------------------------------------- |
---|
103 | DTDAttDef(const DTDAttDef &); |
---|
104 | DTDAttDef& operator = (const DTDAttDef&); |
---|
105 | |
---|
106 | // ----------------------------------------------------------------------- |
---|
107 | // Private data members |
---|
108 | // |
---|
109 | // fElemId |
---|
110 | // This is the id of the element (the id is into the element decl |
---|
111 | // pool) of the element this attribute def said it belonged to. |
---|
112 | // This is used later to link back to the element, mostly for |
---|
113 | // validation purposes. |
---|
114 | // |
---|
115 | // fName |
---|
116 | // This is the name of the attribute. Since we don't do namespaces |
---|
117 | // in the DTD, its just the fully qualified name. |
---|
118 | // ----------------------------------------------------------------------- |
---|
119 | unsigned int fElemId; |
---|
120 | XMLCh* fName; |
---|
121 | }; |
---|
122 | |
---|
123 | |
---|
124 | // --------------------------------------------------------------------------- |
---|
125 | // DTDAttDef: Implementation of the XMLAttDef interface |
---|
126 | // --------------------------------------------------------------------------- |
---|
127 | inline const XMLCh* DTDAttDef::getFullName() const |
---|
128 | { |
---|
129 | return fName; |
---|
130 | } |
---|
131 | |
---|
132 | |
---|
133 | // --------------------------------------------------------------------------- |
---|
134 | // DTDAttDef: Getter methods |
---|
135 | // --------------------------------------------------------------------------- |
---|
136 | inline unsigned int DTDAttDef::getElemId() const |
---|
137 | { |
---|
138 | return fElemId; |
---|
139 | } |
---|
140 | |
---|
141 | inline const XMLCh* DTDAttDef::getDOMTypeInfoName() const |
---|
142 | { |
---|
143 | return getAttTypeString(getType(), getMemoryManager()); |
---|
144 | } |
---|
145 | |
---|
146 | inline const XMLCh* DTDAttDef::getDOMTypeInfoUri() const |
---|
147 | { |
---|
148 | return 0; |
---|
149 | } |
---|
150 | |
---|
151 | // --------------------------------------------------------------------------- |
---|
152 | // DTDAttDef: Setter methods |
---|
153 | // --------------------------------------------------------------------------- |
---|
154 | inline void DTDAttDef::setElemId(const unsigned int newId) |
---|
155 | { |
---|
156 | fElemId = newId; |
---|
157 | } |
---|
158 | |
---|
159 | |
---|
160 | XERCES_CPP_NAMESPACE_END |
---|
161 | |
---|
162 | #endif |
---|