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 #include "qxsdcomplextype_p.h"
43 
44 QT_BEGIN_NAMESPACE
45 
46 using namespace QPatternist;
47 
setMode(Mode mode)48 void XsdComplexType::OpenContent::setMode(Mode mode)
49 {
50     m_mode = mode;
51 }
52 
mode() const53 XsdComplexType::OpenContent::Mode XsdComplexType::OpenContent::mode() const
54 {
55     return m_mode;
56 }
57 
setWildcard(const XsdWildcard::Ptr & wildcard)58 void XsdComplexType::OpenContent::setWildcard(const XsdWildcard::Ptr &wildcard)
59 {
60     m_wildcard = wildcard;
61 }
62 
wildcard() const63 XsdWildcard::Ptr XsdComplexType::OpenContent::wildcard() const
64 {
65     return m_wildcard;
66 }
67 
setVariety(Variety variety)68 void XsdComplexType::ContentType::setVariety(Variety variety)
69 {
70     m_variety = variety;
71 }
72 
variety() const73 XsdComplexType::ContentType::Variety XsdComplexType::ContentType::variety() const
74 {
75     return m_variety;
76 }
77 
setParticle(const XsdParticle::Ptr & particle)78 void XsdComplexType::ContentType::setParticle(const XsdParticle::Ptr &particle)
79 {
80     m_particle = particle;
81 }
82 
particle() const83 XsdParticle::Ptr XsdComplexType::ContentType::particle() const
84 {
85     return m_particle;
86 }
87 
setOpenContent(const OpenContent::Ptr & content)88 void XsdComplexType::ContentType::setOpenContent(const OpenContent::Ptr &content)
89 {
90     m_openContent = content;
91 }
92 
openContent() const93 XsdComplexType::OpenContent::Ptr XsdComplexType::ContentType::openContent() const
94 {
95     return m_openContent;
96 }
97 
setSimpleType(const AnySimpleType::Ptr & type)98 void XsdComplexType::ContentType::setSimpleType(const AnySimpleType::Ptr &type)
99 {
100     m_simpleType = type;
101 }
102 
simpleType() const103 AnySimpleType::Ptr XsdComplexType::ContentType::simpleType() const
104 {
105     return m_simpleType;
106 }
107 
108 
XsdComplexType()109 XsdComplexType::XsdComplexType()
110     : m_isAbstract(false)
111     , m_contentType(new ContentType())
112 {
113     m_contentType->setVariety(ContentType::Empty);
114 }
115 
setIsAbstract(bool abstract)116 void XsdComplexType::setIsAbstract(bool abstract)
117 {
118     m_isAbstract = abstract;
119 }
120 
isAbstract() const121 bool XsdComplexType::isAbstract() const
122 {
123     return m_isAbstract;
124 }
125 
displayName(const NamePool::Ptr & np) const126 QString XsdComplexType::displayName(const NamePool::Ptr &np) const
127 {
128     return np->displayName(name(np));
129 }
130 
setWxsSuperType(const SchemaType::Ptr & type)131 void XsdComplexType::setWxsSuperType(const SchemaType::Ptr &type)
132 {
133     m_superType = type.data();
134 }
135 
wxsSuperType() const136 SchemaType::Ptr XsdComplexType::wxsSuperType() const
137 {
138     return SchemaType::Ptr(m_superType);
139 }
140 
setContext(const NamedSchemaComponent::Ptr & component)141 void XsdComplexType::setContext(const NamedSchemaComponent::Ptr &component)
142 {
143     m_context = component.data();
144 }
145 
context() const146 NamedSchemaComponent::Ptr XsdComplexType::context() const
147 {
148     return NamedSchemaComponent::Ptr(m_context);
149 }
150 
setContentType(const ContentType::Ptr & type)151 void XsdComplexType::setContentType(const ContentType::Ptr &type)
152 {
153     m_contentType = type;
154 }
155 
contentType() const156 XsdComplexType::ContentType::Ptr XsdComplexType::contentType() const
157 {
158     return m_contentType;
159 }
160 
setAttributeUses(const XsdAttributeUse::List & attributeUses)161 void XsdComplexType::setAttributeUses(const XsdAttributeUse::List &attributeUses)
162 {
163     m_attributeUses = attributeUses;
164 }
165 
addAttributeUse(const XsdAttributeUse::Ptr & attributeUse)166 void XsdComplexType::addAttributeUse(const XsdAttributeUse::Ptr &attributeUse)
167 {
168     m_attributeUses.append(attributeUse);
169 }
170 
attributeUses() const171 XsdAttributeUse::List XsdComplexType::attributeUses() const
172 {
173     return m_attributeUses;
174 }
175 
setAttributeWildcard(const XsdWildcard::Ptr & wildcard)176 void XsdComplexType::setAttributeWildcard(const XsdWildcard::Ptr &wildcard)
177 {
178     m_attributeWildcard = wildcard;
179 }
180 
attributeWildcard() const181 XsdWildcard::Ptr XsdComplexType::attributeWildcard() const
182 {
183     return m_attributeWildcard;
184 }
185 
category() const186 XsdComplexType::TypeCategory XsdComplexType::category() const
187 {
188     return ComplexType;
189 }
190 
setDerivationMethod(DerivationMethod method)191 void XsdComplexType::setDerivationMethod(DerivationMethod method)
192 {
193     m_derivationMethod = method;
194 }
195 
derivationMethod() const196 XsdComplexType::DerivationMethod XsdComplexType::derivationMethod() const
197 {
198     return m_derivationMethod;
199 }
200 
setProhibitedSubstitutions(const BlockingConstraints & substitutions)201 void XsdComplexType::setProhibitedSubstitutions(const BlockingConstraints &substitutions)
202 {
203     m_prohibitedSubstitutions = substitutions;
204 }
205 
prohibitedSubstitutions() const206 XsdComplexType::BlockingConstraints XsdComplexType::prohibitedSubstitutions() const
207 {
208     return m_prohibitedSubstitutions;
209 }
210 
setAssertions(const XsdAssertion::List & assertions)211 void XsdComplexType::setAssertions(const XsdAssertion::List &assertions)
212 {
213     m_assertions = assertions;
214 }
215 
addAssertion(const XsdAssertion::Ptr & assertion)216 void XsdComplexType::addAssertion(const XsdAssertion::Ptr &assertion)
217 {
218     m_assertions.append(assertion);
219 }
220 
assertions() const221 XsdAssertion::List XsdComplexType::assertions() const
222 {
223     return m_assertions;
224 }
225 
isDefinedBySchema() const226 bool XsdComplexType::isDefinedBySchema() const
227 {
228     return true;
229 }
230 
231 QT_END_NAMESPACE
232