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

Revision 358, 7.3 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: XSAttributeDeclaration.hpp,v $
19 * Revision 1.10  2004/09/08 13:56:07  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.9  2004/05/04 19:02:40  cargilld
23 * Enable IDs to work on all kinds of schema components
24 *
25 * Revision 1.8  2003/12/24 17:42:02  knoaman
26 * Misc. PSVI updates
27 *
28 * Revision 1.7  2003/12/01 23:23:26  neilg
29 * fix for bug 25118; thanks to Jeroen Witmond
30 *
31 * Revision 1.6  2003/11/21 22:34:45  neilg
32 * More schema component model implementation, thanks to David Cargill.
33 * In particular, this cleans up and completes the XSModel, XSNamespaceItem,
34 * XSAttributeDeclaration and XSAttributeGroup implementations.
35 *
36 * Revision 1.5  2003/11/21 17:19:30  knoaman
37 * PSVI update.
38 *
39 * Revision 1.4  2003/11/14 22:47:53  neilg
40 * fix bogus log message from previous commit...
41 *
42 * Revision 1.3  2003/11/14 22:33:30  neilg
43 * Second phase of schema component model implementation. 
44 * Implement XSModel, XSNamespaceItem, and the plumbing necessary
45 * to connect them to the other components.
46 * Thanks to David Cargill.
47 *
48 * Revision 1.2  2003/11/06 15:30:04  neilg
49 * 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.
50 *
51 * Revision 1.1  2003/09/16 14:33:36  neilg
52 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
53 *
54 */
55
56#if !defined(XSATTRIBUTEDECLARATION_HPP)
57#define XSATTRIBUTEDECLARATION_HPP
58
59#include <xercesc/framework/psvi/XSObject.hpp>
60
61XERCES_CPP_NAMESPACE_BEGIN
62
63/**
64 * This class describes all properties of a Schema Attribute
65 * Declaration component.
66 * This is *always* owned by the validator /parser object from which
67 * it is obtained. 
68 */
69
70// forward declarations
71class XSAnnotation;
72class XSComplexTypeDefinition;
73class XSSimpleTypeDefinition;
74class SchemaAttDef;
75
76class XMLPARSER_EXPORT XSAttributeDeclaration : public XSObject
77{
78public:
79
80    //  Constructors and Destructor
81    // -----------------------------------------------------------------------
82    /** @name Constructors */
83    //@{
84
85    /**
86      * The default constructor
87      *
88      * @param  attDef     
89      * @param  typeDef     
90      * @param  annot       
91      * @param  xsModel     
92      * @param  scope       
93      * @param  enclosingCTDefinition
94      * @param  manager     The configurable memory manager
95      */
96    XSAttributeDeclaration
97    (
98        SchemaAttDef* const             attDef
99        , XSSimpleTypeDefinition* const typeDef
100        , XSAnnotation* const           annot
101        , XSModel* const                xsModel
102        , XSConstants::SCOPE            scope
103        , XSComplexTypeDefinition*      enclosingCTDefinition
104        , MemoryManager* const          manager = XMLPlatformUtils::fgMemoryManager
105    );
106
107    //@};
108
109    /** @name Destructor */
110    //@{
111    ~XSAttributeDeclaration();
112    //@}
113
114    //---------------------
115    /** @name overridden XSObject methods */
116
117    //@{
118
119    /**
120     * The name of type <code>NCName</code> of this declaration as defined in
121     * XML Namespaces.
122     */
123    const XMLCh* getName();
124
125    /**
126     *  The [target namespace] of this object, or <code>null</code> if it is
127     * unspecified.
128     */
129    const XMLCh* getNamespace();
130
131    /**
132     * A namespace schema information item corresponding to the target
133     * namespace of the component, if it's globally declared; or null
134     * otherwise.
135     */
136    XSNamespaceItem* getNamespaceItem();
137
138    //@}
139
140    /** @name XSAttributeDeclaration methods **/
141
142    //@{
143
144    /**
145     * [type definition]: A simple type definition
146     */
147    XSSimpleTypeDefinition *getTypeDefinition() const;
148
149    /**
150     * Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>,
151     * or <code>SCOPE_ABSENT</code>. If the scope is local, then the
152     * <code>enclosingCTDefinition</code> is present.
153     */
154    XSConstants::SCOPE getScope() const;
155
156    /**
157     * The complex type definition for locally scoped declarations (see
158     * <code>scope</code>).
159     */
160    XSComplexTypeDefinition *getEnclosingCTDefinition();
161
162    /**
163     * Value constraint: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>.
164     */
165    XSConstants::VALUE_CONSTRAINT getConstraintType() const;
166
167    /**
168     * Value constraint: The actual value with respect to the [type definition
169     * ].
170     */
171    const XMLCh *getConstraintValue();
172
173    /**
174     * Optional. Annotation.
175     */
176    XSAnnotation *getAnnotation() const;
177
178    //@}
179
180    //----------------------------------
181    /** methods needed by implementation */
182
183    //@{
184
185    bool getRequired() const;
186    //@}
187
188private:
189
190    void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet);
191    friend class XSObjectFactory;
192
193    // -----------------------------------------------------------------------
194    //  Unimplemented constructors and operators
195    // -----------------------------------------------------------------------
196    XSAttributeDeclaration(const XSAttributeDeclaration&);
197    XSAttributeDeclaration & operator=(const XSAttributeDeclaration &);
198
199protected:
200
201    // -----------------------------------------------------------------------
202    //  data members
203    // -----------------------------------------------------------------------
204    SchemaAttDef*               fAttDef;
205    XSSimpleTypeDefinition*     fTypeDefinition;
206    XSAnnotation*               fAnnotation;
207    XSConstants::SCOPE          fScope;
208    XSComplexTypeDefinition*    fEnclosingCTDefinition;
209};
210
211// ---------------------------------------------------------------------------
212//  XSAttributeDeclaration: inline methods
213// ---------------------------------------------------------------------------
214inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const
215{
216    return fTypeDefinition;
217}
218
219inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const
220{
221    return fAnnotation;
222}
223
224inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const
225{   
226    return fScope;
227}
228
229inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition()
230{
231    return fEnclosingCTDefinition;
232}
233
234inline void XSAttributeDeclaration::setEnclosingCTDefinition
235(
236    XSComplexTypeDefinition* const toSet
237)
238{
239    fEnclosingCTDefinition = toSet;
240}
241
242XERCES_CPP_NAMESPACE_END
243
244#endif
Note: See TracBrowser for help on using the repository browser.