1 /****************************************************************************
3 ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
52 #ifndef Patternist_XsdAttribute_H
53 #define Patternist_XsdAttribute_H
55 #include <private/qanysimpletype_p.h>
56 #include <private/qnamedschemacomponent_p.h>
57 #include <private/qxsdannotated_p.h>
59 #include <QtCore/QList>
68 * @short Represents a XSD attribute object.
70 * This class represents the <em>attribute</em> object of a XML schema as described
71 * <a href="http://www.w3.org/TR/xmlschema11-1/#cAttribute_Declarations">here</a>.
73 * It contains information from either a top-level attribute declaration (as child of
74 * a <em>schema</em> object) or of a local attribute declaration (as child of <em>complexType</em>
75 * or <em>attributeGroup</em> object without a 'ref' attribute).
77 * All other occurrences of the <em>attribute</em> object are represented by the XsdAttributeUse class.
79 * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSAttributeDeclaration">XML Schema API reference</a>
80 * @ingroup Patternist_schema
81 * @author Tobias Koenig <tobias.koenig@nokia.com>
83 class XsdAttribute : public NamedSchemaComponent, public XsdAnnotated
86 typedef QExplicitlySharedDataPointer<XsdAttribute> Ptr;
87 typedef QList<XsdAttribute::Ptr> List;
90 * @short Describes the scope of an attribute.
92 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_a">Scope Definition</a>
94 class Scope : public QSharedData
97 typedef QExplicitlySharedDataPointer<Scope> Ptr;
100 * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ad-scope">scope</a> of an attribute.
104 Global, ///< The attribute is defined globally as child of the <em>schema</em> object.
105 Local ///< The attribute is defined locally as child of a complex type or attribute group definition.
109 * Sets the @p variety of the attribute scope.
111 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_a-variety">Variety Definition</a>
113 void setVariety(Variety variety);
116 * Returns the variety of the attribute scope.
118 Variety variety() const;
121 * Sets the @p parent complex type or attribute group definition of the attribute scope.
123 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#sc_a-parent">Parent Definition</a>
125 void setParent(const NamedSchemaComponent::Ptr &parent);
128 * Returns the parent complex type or attribute group definition of the attribute scope.
130 NamedSchemaComponent::Ptr parent() const;
134 NamedSchemaComponent::Ptr m_parent;
139 * @short Describes the value constraint of an attribute.
141 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a">Value Constraint Definition</a>
143 class ValueConstraint : public QSharedData
146 typedef QExplicitlySharedDataPointer<ValueConstraint> Ptr;
149 * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ad-value_constraint">value constraint</a> of an attribute.
153 Default, ///< The attribute has a default value set.
154 Fixed ///< The attribute has a fixed value set.
158 * Sets the @p variety of the attribute value constraint.
160 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a-variety">Variety Definition</a>
162 void setVariety(Variety variety);
165 * Returns the variety of the attribute value constraint.
167 Variety variety() const;
170 * Sets the @p value of the constraint.
172 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a-value">Value Definition</a>
174 void setValue(const QString &value);
177 * Returns the value of the constraint.
179 QString value() const;
182 * Sets the lexical @p form of the constraint.
184 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#vc_a-lexical_form">Lexical Form Definition</a>
186 void setLexicalForm(const QString &form);
189 * Returns the lexical form of the constraint.
191 QString lexicalForm() const;
196 QString m_lexicalForm;
200 * Sets the simple @p type definition of the attribute.
202 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ad-type_definition">Simple Type Definition</a>
204 void setType(const AnySimpleType::Ptr &type);
207 * Returns the simple type definition of the attribute.
209 AnySimpleType::Ptr type() const;
212 * Sets the @p scope of the attribute.
214 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ad-scope">Scope Definition</a>
216 void setScope(const Scope::Ptr &scope);
219 * Returns the scope of the attribute.
221 Scope::Ptr scope() const;
224 * Sets the value @p constraint of the attribute.
226 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#ad-value_constraint">Value Constraint Definition</a>
228 void setValueConstraint(const ValueConstraint::Ptr &constraint);
231 * Returns the value constraint of the attribute.
233 ValueConstraint::Ptr valueConstraint() const;
236 AnySimpleType::Ptr m_type;
238 ValueConstraint::Ptr m_valueConstraint;