Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
[qt-netbsd.git] / src / xmlpatterns / schema / qxsdattribute_p.h
blobd64d335431149a444c380a65e784ae1c655bc77a
1 /****************************************************************************
2 **
3 ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ****************************************************************************/
43 // W A R N I N G
44 // -------------
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.
50 // We mean it.
52 #ifndef Patternist_XsdAttribute_H
53 #define Patternist_XsdAttribute_H
55 #include "qanysimpletype_p.h"
56 #include "qnamedschemacomponent_p.h"
57 #include "qxsdannotated_p.h"
59 #include <QtCore/QList>
61 QT_BEGIN_HEADER
63 QT_BEGIN_NAMESPACE
65 namespace QPatternist
67 /**
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
85 public:
86 typedef QExplicitlySharedDataPointer<XsdAttribute> Ptr;
87 typedef QList<XsdAttribute::Ptr> List;
89 /**
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
96 public:
97 typedef QExplicitlySharedDataPointer<Scope> Ptr;
99 /**
100 * Describes the <a href="http://www.w3.org/TR/xmlschema11-1/#ad-scope">scope</a> of an attribute.
102 enum Variety
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;
132 private:
133 Variety m_variety;
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
145 public:
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.
151 enum Variety
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;
193 private:
194 Variety m_variety;
195 QString m_value;
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;
235 private:
236 AnySimpleType::Ptr m_type;
237 Scope::Ptr m_scope;
238 ValueConstraint::Ptr m_valueConstraint;
242 QT_END_NAMESPACE
244 QT_END_HEADER
246 #endif