source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/framework/psvi/XSAttributeDeclaration.hpp @ 2674

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