source: NonGTP/Xerces/xerces/include/xercesc/framework/psvi/PSVIAttribute.hpp @ 358

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

xerces added

Line 
1/*
2 * Copyright 2003,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: PSVIAttribute.hpp,v $
19 * Revision 1.7  2004/09/08 13:56:07  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.6  2003/12/30 05:58:56  neilg
23 * allow schema normalized values to be associated with a PSVIAttribute after it is reset
24 *
25 * Revision 1.5  2003/11/28 20:20:54  neilg
26 * make use of canonical representation in PSVIAttribute implementation
27 *
28 * Revision 1.4  2003/11/27 06:10:32  neilg
29 * PSVIAttribute implementation
30 *
31 * Revision 1.3  2003/11/06 21:50:33  neilg
32 * fix compilation errors under gcc 3.3.
33 *
34 * Revision 1.2  2003/11/06 15:30:04  neilg
35 * first part of PSVI/schema component model implementation, thanks to David Cargill.  This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
36 *
37 * Revision 1.1  2003/09/16 14:33:36  neilg
38 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
39 *
40 */
41
42#if !defined(PSVIATTRIBUTE_HPP)
43#define PSVIATTRIBUTE_HPP
44
45#include <xercesc/framework/psvi/PSVIItem.hpp>
46#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
47#include <xercesc/validators/datatype/DatatypeValidator.hpp>
48
49XERCES_CPP_NAMESPACE_BEGIN
50
51/**
52 * Represent the PSVI contributions for one attribute information item.
53 * This is *always* owned by the scanner/parser object from which
54 * it is obtained.  The validator will specify
55 * under what conditions it may be relied upon to have meaningful contents.
56 */
57
58// forward declarations
59class XSAttributeDeclaration;
60
61class XMLPARSER_EXPORT PSVIAttribute : public PSVIItem 
62{
63public:
64
65    //  Constructors and Destructor
66    // -----------------------------------------------------------------------
67    /** @name Constructors */
68    //@{
69
70    /**
71      * The default constructor
72      *
73      * @param  manager     The configurable memory manager
74      */
75    PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
76
77    //@};
78
79    /** @name Destructor */
80    //@{
81    ~PSVIAttribute();
82    //@}
83
84    //---------------------
85    /** @name PSVIAttribute methods */
86
87    //@{
88
89    /**
90     * An item isomorphic to the attribute declaration used to validate
91     * this attribute.
92     *
93     * @return  an attribute declaration
94     */
95    XSAttributeDeclaration *getAttributeDeclaration();
96   
97    /**
98     * An item isomorphic to the type definition used to validate this element.
99     *
100     * @return  a type declaration
101     */
102    XSTypeDefinition *getTypeDefinition();
103   
104    /**
105     * If and only if that type definition is a simple type definition
106     * with {variety} union, or a complex type definition whose {content type}
107     * is a simple thype definition with {variety} union, then an item isomorphic
108     * to that member of the union's {member type definitions} which actually
109     * validated the element item's normalized value.
110     *
111     * @return  a simple type declaration
112     */
113    XSSimpleTypeDefinition *getMemberTypeDefinition();
114   
115    //@}
116
117    //----------------------------------
118    /** methods needed by implementation */
119
120    //@{
121
122    /**
123      * reset this object.  Intended to be called by
124      * the implementation.
125      */
126    void reset(
127            const XMLCh * const         valContext
128            , PSVIItem::VALIDITY_STATE  state
129            , PSVIItem::ASSESSMENT_TYPE assessmentType
130            , XSSimpleTypeDefinition *  validatingType
131            , XSSimpleTypeDefinition *  memberType
132            , const XMLCh * const       defaultValue
133            , const bool                isSpecified
134            , XSAttributeDeclaration *  attrDecl
135            , DatatypeValidator *       dv
136        );
137
138    /**
139      * set the schema normalized value (and
140      * implicitly the canonical value) of this object; intended to be used
141      * by the implementation.
142      */
143    void setValue(const XMLCh * const       normalizedValue);
144
145    /**
146      * set VALIDITY_STATE to specified value; intended to be
147      * called by implementation.
148      */
149    void updateValidity(VALIDITY_STATE newValue);
150
151    //@}
152
153private:
154
155    // -----------------------------------------------------------------------
156    //  Unimplemented constructors and operators
157    // -----------------------------------------------------------------------
158    PSVIAttribute(const PSVIAttribute&);
159    PSVIAttribute & operator=(const PSVIAttribute &);
160
161
162    // -----------------------------------------------------------------------
163    //  data members
164    // -----------------------------------------------------------------------
165    // fAttributeDecl
166    //      attribute declaration component that validated this attribute
167    // fDV
168    //      implementation-specific datatype validator used to validate this attribute
169    XSAttributeDeclaration *    fAttributeDecl;
170    DatatypeValidator *         fDV;
171};
172inline PSVIAttribute::~PSVIAttribute()
173{
174    fMemoryManager->deallocate((void *)fCanonicalValue);
175}
176
177inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration()
178{
179    return fAttributeDecl;
180}
181
182inline XSTypeDefinition* PSVIAttribute::getTypeDefinition()
183{
184    return fType;
185}
186
187inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition()
188{
189    return fMemberType;
190}
191
192inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue)
193{
194    fValidityState = newValue;
195}
196
197XERCES_CPP_NAMESPACE_END
198
199#endif
Note: See TracBrowser for help on using the repository browser.