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_XsdSimpleType_H
53 #define Patternist_XsdSimpleType_H
55 #include <private/qanysimpletype_p.h>
56 #include <private/qxsdfacet_p.h>
57 #include <private/qxsduserschematype_p.h>
59 #include <QtCore/QSet>
68 * @short Represents a XSD simpleType object.
70 * This class represents the <em>simpleType</em> object of a XML schema as described
71 * <a href="http://www.w3.org/TR/xmlschema-2/#rf-defn">here</a>.
73 * It contains information from either a top-level simple type declaration (as child of a <em>schema</em> object)
74 * or a local simple type declaration (as descendant of an <em>element</em> or <em>complexType</em> object).
76 * @see <a href="http://www.w3.org/Submission/2004/SUBM-xmlschema-api-20040309/xml-schema-api.html#Interface-XSSimpleType">XML Schema API reference</a>
77 * @ingroup Patternist_schema
78 * @author Tobias Koenig <tobias.koenig@nokia.com>
80 class XsdSimpleType : public XsdUserSchemaType<AnySimpleType>
83 typedef QExplicitlySharedDataPointer<XsdSimpleType> Ptr;
86 * Returns the display name of the simple type.
88 * @param namePool The name pool the type name is stored in.
90 virtual QString displayName(const NamePool::Ptr &namePool) const;
93 * Sets the base @p type of the simple type.
95 * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-basetype">Base Type Definition</a>
97 void setWxsSuperType(const SchemaType::Ptr &type);
100 * Returns the base type of the simple type or an empty pointer if no base type is
103 virtual SchemaType::Ptr wxsSuperType() const;
106 * Sets the context @p component of the simple type.
108 * @see <a href="http://www.w3.org/TR/xmlschema11-1/#std-context">Context Definition</a>
110 void setContext(const NamedSchemaComponent::Ptr &component);
113 * Returns the context component of the simple type.
115 NamedSchemaComponent::Ptr context() const;
118 * Sets the primitive @p type of the simple type.
120 * The primitive type is only specified if the category is SimpleTypeAtomic.
122 * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-primitive">Primitive Type Definition</a>
124 void setPrimitiveType(const AnySimpleType::Ptr &type);
127 * Returns the primitive type of the simple type or an empty pointer if the category is
128 * not SimpleTypeAtomic.
130 AnySimpleType::Ptr primitiveType() const;
133 * Sets the list item @p type of the simple type.
135 * The list item type is only specified if the category is SimpleTypeList.
137 * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-itemType">Item Type Definition</a>
139 void setItemType(const AnySimpleType::Ptr &type);
142 * Returns the list item type of the simple type or an empty pointer if the category is
143 * not SimpleTypeList.
145 AnySimpleType::Ptr itemType() const;
148 * Sets the member @p types of the simple type.
150 * The member types are only specified if the category is SimpleTypeUnion.
152 * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-memberTypes">Member Types Definition</a>
154 void setMemberTypes(const AnySimpleType::List &types);
157 * Returns the list member types of the simple type or an empty list if the category is
158 * not SimpleTypeUnion.
160 AnySimpleType::List memberTypes() const;
163 * Sets the @p facets of the simple type.
165 * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-facets">Facets Definition</a>
167 void setFacets(const XsdFacet::Hash &facets);
170 * Returns the facets of the simple type.
172 XsdFacet::Hash facets() const;
175 * Sets the @p category (variety) of the simple type.
177 * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-variety">Variety Definition</a>
179 void setCategory(TypeCategory category);
182 * Returns the category (variety) of the simple type.
184 virtual TypeCategory category() const;
187 * Sets the derivation @p method of the simple type.
189 * @see DerivationMethod
191 void setDerivationMethod(DerivationMethod method);
194 * Returns the derivation method of the simple type.
196 virtual DerivationMethod derivationMethod() const;
199 * Always returns @c true.
201 virtual bool isDefinedBySchema() const;
204 SchemaType::Ptr m_superType;
205 NamedSchemaComponent::Ptr m_context;
206 AnySimpleType::Ptr m_primitiveType;
207 AnySimpleType::Ptr m_itemType;
208 AnySimpleType::List m_memberTypes;
209 XsdFacet::Hash m_facets;
210 TypeCategory m_typeCategory;
211 DerivationMethod m_derivationMethod;