source: icXML/icXML-devel/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp @ 2722

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

Original Xerces files with import mods for icxercesc

File size: 5.8 KB
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 * $Id: XSAttributeDeclaration.hpp 527149 2007-04-10 14:56:39Z amassari $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP)
23#define XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP
24
25#include <xercesc/framework/psvi/XSObject.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29/**
30 * This class describes all properties of a Schema Attribute
31 * Declaration component.
32 * This is *always* owned by the validator /parser object from which
33 * it is obtained. 
34 */
35
36// forward declarations
37class XSAnnotation;
38class XSComplexTypeDefinition;
39class XSSimpleTypeDefinition;
40class SchemaAttDef;
41
42class XMLPARSER_EXPORT XSAttributeDeclaration : public XSObject
43{
44public:
45
46    //  Constructors and Destructor
47    // -----------------------------------------------------------------------
48    /** @name Constructors */
49    //@{
50
51    /**
52      * The default constructor
53      *
54      * @param  attDef     
55      * @param  typeDef     
56      * @param  annot       
57      * @param  xsModel     
58      * @param  scope       
59      * @param  enclosingCTDefinition
60      * @param  manager     The configurable memory manager
61      */
62    XSAttributeDeclaration
63    (
64        SchemaAttDef* const             attDef
65        , XSSimpleTypeDefinition* const typeDef
66        , XSAnnotation* const           annot
67        , XSModel* const                xsModel
68        , XSConstants::SCOPE            scope
69        , XSComplexTypeDefinition*      enclosingCTDefinition
70        , MemoryManager* const          manager = XMLPlatformUtils::fgMemoryManager
71    );
72
73    //@};
74
75    /** @name Destructor */
76    //@{
77    ~XSAttributeDeclaration();
78    //@}
79
80    //---------------------
81    /** @name overridden XSObject methods */
82
83    //@{
84
85    /**
86     * The name of type <code>NCName</code> of this declaration as defined in
87     * XML Namespaces.
88     */
89    const XMLCh* getName() const;
90
91    /**
92     *  The [target namespace] of this object, or <code>null</code> if it is
93     * unspecified.
94     */
95    const XMLCh* getNamespace();
96
97    /**
98     * A namespace schema information item corresponding to the target
99     * namespace of the component, if it's globally declared; or null
100     * otherwise.
101     */
102    XSNamespaceItem* getNamespaceItem();
103
104    //@}
105
106    /** @name XSAttributeDeclaration methods **/
107
108    //@{
109
110    /**
111     * [type definition]: A simple type definition
112     */
113    XSSimpleTypeDefinition *getTypeDefinition() const;
114
115    /**
116     * Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>,
117     * or <code>SCOPE_ABSENT</code>. If the scope is local, then the
118     * <code>enclosingCTDefinition</code> is present.
119     */
120    XSConstants::SCOPE getScope() const;
121
122    /**
123     * The complex type definition for locally scoped declarations (see
124     * <code>scope</code>).
125     */
126    XSComplexTypeDefinition *getEnclosingCTDefinition();
127
128    /**
129     * Value constraint: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>.
130     */
131    XSConstants::VALUE_CONSTRAINT getConstraintType() const;
132
133    /**
134     * Value constraint: The actual value with respect to the [type definition
135     * ].
136     */
137    const XMLCh *getConstraintValue();
138
139    /**
140     * Optional. Annotation.
141     */
142    XSAnnotation *getAnnotation() const;
143
144    //@}
145
146    //----------------------------------
147    /** methods needed by implementation */
148
149    //@{
150
151    bool getRequired() const;
152    //@}
153
154private:
155
156    void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet);
157    friend class XSObjectFactory;
158
159    // -----------------------------------------------------------------------
160    //  Unimplemented constructors and operators
161    // -----------------------------------------------------------------------
162    XSAttributeDeclaration(const XSAttributeDeclaration&);
163    XSAttributeDeclaration & operator=(const XSAttributeDeclaration &);
164
165protected:
166
167    // -----------------------------------------------------------------------
168    //  data members
169    // -----------------------------------------------------------------------
170    SchemaAttDef*               fAttDef;
171    XSSimpleTypeDefinition*     fTypeDefinition;
172    XSAnnotation*               fAnnotation;
173    XSConstants::SCOPE          fScope;
174    XSComplexTypeDefinition*    fEnclosingCTDefinition;
175};
176
177// ---------------------------------------------------------------------------
178//  XSAttributeDeclaration: inline methods
179// ---------------------------------------------------------------------------
180inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const
181{
182    return fTypeDefinition;
183}
184
185inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const
186{
187    return fAnnotation;
188}
189
190inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const
191{   
192    return fScope;
193}
194
195inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition()
196{
197    return fEnclosingCTDefinition;
198}
199
200inline void XSAttributeDeclaration::setEnclosingCTDefinition
201(
202    XSComplexTypeDefinition* const toSet
203)
204{
205    fEnclosingCTDefinition = toSet;
206}
207
208XERCES_CPP_NAMESPACE_END
209
210#endif
Note: See TracBrowser for help on using the repository browser.