Update copyright year in license headers.
[profile/ivi/qtxmlpatterns.git] / src / xmlpatterns / schema / qxsdsimpletype_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 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 ** 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.
17 **
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.
21 **
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.
29 **
30 ** Other Usage
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.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 //
43 //  W A R N I N G
44 //  -------------
45 //
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.
49 //
50 // We mean it.
51
52 #ifndef Patternist_XsdSimpleType_H
53 #define Patternist_XsdSimpleType_H
54
55 #include <private/qanysimpletype_p.h>
56 #include <private/qxsdfacet_p.h>
57 #include <private/qxsduserschematype_p.h>
58
59 #include <QtCore/QSet>
60
61 QT_BEGIN_HEADER
62
63 QT_BEGIN_NAMESPACE
64
65 namespace QPatternist
66 {
67     /**
68      * @short Represents a XSD simpleType object.
69      *
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>.
72      *
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).
75      *
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>
79      */
80     class XsdSimpleType : public XsdUserSchemaType<AnySimpleType>
81     {
82         public:
83             typedef QExplicitlySharedDataPointer<XsdSimpleType> Ptr;
84
85             /**
86              * Returns the display name of the simple type.
87              *
88              * @param namePool The name pool the type name is stored in.
89              */
90             virtual QString displayName(const NamePool::Ptr &namePool) const;
91
92             /**
93              * Sets the base @p type of the simple type.
94              *
95              * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-basetype">Base Type Definition</a>
96              */
97             void setWxsSuperType(const SchemaType::Ptr &type);
98
99             /**
100              * Returns the base type of the simple type or an empty pointer if no base type is
101              * set.
102              */
103             virtual SchemaType::Ptr wxsSuperType() const;
104
105             /**
106              * Sets the context @p component of the simple type.
107              *
108              * @see <a href="http://www.w3.org/TR/xmlschema11-1/#std-context">Context Definition</a>
109              */
110             void setContext(const NamedSchemaComponent::Ptr &component);
111
112             /**
113              * Returns the context component of the simple type.
114              */
115             NamedSchemaComponent::Ptr context() const;
116
117             /**
118              * Sets the primitive @p type of the simple type.
119              *
120              * The primitive type is only specified if the category is SimpleTypeAtomic.
121              *
122              * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-primitive">Primitive Type Definition</a>
123              */
124             void setPrimitiveType(const AnySimpleType::Ptr &type);
125
126             /**
127              * Returns the primitive type of the simple type or an empty pointer if the category is
128              * not SimpleTypeAtomic.
129              */
130             AnySimpleType::Ptr primitiveType() const;
131
132             /**
133              * Sets the list item @p type of the simple type.
134              *
135              * The list item type is only specified if the category is SimpleTypeList.
136              *
137              * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-itemType">Item Type Definition</a>
138              */
139             void setItemType(const AnySimpleType::Ptr &type);
140
141             /**
142              * Returns the list item type of the simple type or an empty pointer if the category is
143              * not SimpleTypeList.
144              */
145             AnySimpleType::Ptr itemType() const;
146
147             /**
148              * Sets the member @p types of the simple type.
149              *
150              * The member types are only specified if the category is SimpleTypeUnion.
151              *
152              * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-memberTypes">Member Types Definition</a>
153              */
154             void setMemberTypes(const AnySimpleType::List &types);
155
156             /**
157              * Returns the list member types of the simple type or an empty list if the category is
158              * not SimpleTypeUnion.
159              */
160             AnySimpleType::List memberTypes() const;
161
162             /**
163              * Sets the @p facets of the simple type.
164              *
165              * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-facets">Facets Definition</a>
166              */
167             void setFacets(const XsdFacet::Hash &facets);
168
169             /**
170              * Returns the facets of the simple type.
171              */
172             XsdFacet::Hash facets() const;
173
174             /**
175              * Sets the @p category (variety) of the simple type.
176              *
177              * @see <a href="http://www.w3.org/TR/xmlschema-2/#defn-variety">Variety Definition</a>
178              */
179             void setCategory(TypeCategory category);
180
181             /**
182              * Returns the category (variety) of the simple type.
183              */
184             virtual TypeCategory category() const;
185
186             /**
187              * Sets the derivation @p method of the simple type.
188              *
189              * @see DerivationMethod
190              */
191             void setDerivationMethod(DerivationMethod method);
192
193             /**
194              * Returns the derivation method of the simple type.
195              */
196             virtual DerivationMethod derivationMethod() const;
197
198             /**
199              * Always returns @c true.
200              */
201             virtual bool isDefinedBySchema() const;
202
203         private:
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;
212     };
213 }
214
215 QT_END_NAMESPACE
216
217 QT_END_HEADER
218
219 #endif