1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2015 The Qt Company Ltd. 4 ** Contact: http://www.qt.io/licensing/ 5 ** 6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see http://www.qt.io/terms-conditions. For further 15 ** information use the contact form at http://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 2.1 or version 3 as published by the Free 20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 ** following information to ensure the GNU Lesser General Public License 23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 ** 26 ** As a special exception, The Qt Company gives you certain additional 27 ** rights. These rights are described in The Qt Company LGPL Exception 28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 ** 30 ** GNU General Public License Usage 31 ** Alternatively, this file may be used under the terms of the GNU 32 ** General Public License version 3.0 as published by the Free Software 33 ** Foundation and appearing in the file LICENSE.GPL included in the 34 ** packaging of this file. Please review the following information to 35 ** ensure the GNU General Public License version 3.0 requirements will be 36 ** met: http://www.gnu.org/copyleft/gpl.html. 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 "qanysimpletype_p.h" 56 #include "qxsdfacet_p.h" 57 #include "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* 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 220