source: icXML/icXML-devel/src/icxercesc/validators/DTD/DTDAttDef.hpp @ 2720

Last change on this file since 2720 was 2720, checked in by cameron, 6 years ago

Initial check-in of icXML 0.8 source files

File size: 4.6 KB
Line 
1/*
2 * Unless required by applicable law or agreed to in writing, software
3 * distributed under the License is distributed on an "AS IS" BASIS,
4 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 * See the License for the specific language governing permissions and
6 * limitations under the License.
7 */
8
9/*
10 * $Id: DTDAttDef.hpp 676911 2008-07-15 13:27:32Z amassari $
11 */
12
13#if !defined(XERCESC_INCLUDE_GUARD_DTDATTDEF_HPP)
14#define XERCESC_INCLUDE_GUARD_DTDATTDEF_HPP
15
16#include <xercesc/framework/XMLAttDef.hpp>
17#include <icxmlc/XMLConfig.hpp>
18
19XERCES_CPP_NAMESPACE_BEGIN
20
21class DTDScanner;
22
23//
24//  This class is a derivative of the core XMLAttDef class. This class adds
25//  any DTD specific data members and provides DTD specific implementations
26//  of any underlying attribute def virtual methods.
27//
28//  In the DTD we don't do namespaces, so the attribute names are just the
29//  QName literally from the DTD. This is what we return as the full name,
30//  which is what is used to key these in any name keyed collections.
31//
32class VALIDATORS_EXPORT DTDAttDef : public XMLAttDef
33{
34public :
35        // -----------------------------------------------------------------------
36        //  Constructors and Destructors
37        // -----------------------------------------------------------------------
38        DTDAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
39        DTDAttDef
40        (
41                const   XMLCh* const           attName
42                , const XMLAttDef::AttTypes    type = CData
43                , const XMLAttDef::DefAttTypes defType = Implied
44                , MemoryManager* const         manager = XMLPlatformUtils::fgMemoryManager
45        );
46        DTDAttDef
47        (
48                const   XMLCh* const           attName
49                , const XMLCh* const           attValue
50                , const XMLAttDef::AttTypes    type
51                , const XMLAttDef::DefAttTypes defType
52                , const XMLCh* const           enumValues = 0
53                , MemoryManager* const         manager = XMLPlatformUtils::fgMemoryManager
54        );
55        ~DTDAttDef();
56
57
58        // -----------------------------------------------------------------------
59        //  Implementation of the XMLAttDef interface
60        // -----------------------------------------------------------------------
61        virtual const XMLCh* getFullName() const;
62
63        //does nothing currently
64        virtual void reset() {};
65
66        // -----------------------------------------------------------------------
67        //  Getter methods
68        // -----------------------------------------------------------------------
69        XMLSize_t getElemId() const;
70        virtual QName* getAttName() const;
71
72        // -----------------------------------------------------------------------
73        //  Setter methods
74        // -----------------------------------------------------------------------
75        void setElemId(const XMLSize_t newId);
76        void setName(const XMLCh* const newName);
77
78        /***
79         * Support for Serialization/De-serialization
80         ***/
81        DECL_XSERIALIZABLE(DTDAttDef)
82
83private :
84        // -----------------------------------------------------------------------
85        // Unimplemented constructors and operators
86        // -----------------------------------------------------------------------
87        DTDAttDef(const DTDAttDef &);
88        DTDAttDef& operator = (const  DTDAttDef&);
89
90        // -----------------------------------------------------------------------
91        //  Private data members
92        //
93        //  fElemId
94        //      This is the id of the element (the id is into the element decl
95        //      pool) of the element this attribute def said it belonged to.
96        //      This is used later to link back to the element, mostly for
97        //      validation purposes.
98        //
99        //  fName
100        //      This is the name of the attribute. Since we don't do namespaces
101        //      in the DTD, its just the fully qualified name.
102        // -----------------------------------------------------------------------
103        XMLSize_t       fElemId;
104        QName*          fAttName;
105        XMLCh*          fName;
106
107
108    friend class DTDScanner;
109};
110
111
112// ---------------------------------------------------------------------------
113//  DTDAttDef: Implementation of the XMLAttDef interface
114// ---------------------------------------------------------------------------
115inline const XMLCh* DTDAttDef::getFullName() const
116{
117        return fAttName->getRawName();
118}
119
120inline QName* DTDAttDef::getAttName() const
121{
122        return fAttName;
123}
124
125// ---------------------------------------------------------------------------
126//  DTDAttDef: Getter methods
127// ---------------------------------------------------------------------------
128inline XMLSize_t DTDAttDef::getElemId() const
129{
130        return fElemId;
131}
132
133// ---------------------------------------------------------------------------
134//  DTDAttDef: Setter methods
135// ---------------------------------------------------------------------------
136inline void DTDAttDef::setElemId(const XMLSize_t newId)
137{
138        fElemId = newId;
139}
140
141
142XERCES_CPP_NAMESPACE_END
143
144#endif
Note: See TracBrowser for help on using the repository browser.