1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://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 https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://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 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #include "qxsdcomplextype_p.h"
41 
42 QT_BEGIN_NAMESPACE
43 
44 using namespace QPatternist;
45 
setMode(Mode mode)46 void XsdComplexType::OpenContent::setMode(Mode mode)
47 {
48     m_mode = mode;
49 }
50 
mode() const51 XsdComplexType::OpenContent::Mode XsdComplexType::OpenContent::mode() const
52 {
53     return m_mode;
54 }
55 
setWildcard(const XsdWildcard::Ptr & wildcard)56 void XsdComplexType::OpenContent::setWildcard(const XsdWildcard::Ptr &wildcard)
57 {
58     m_wildcard = wildcard;
59 }
60 
wildcard() const61 XsdWildcard::Ptr XsdComplexType::OpenContent::wildcard() const
62 {
63     return m_wildcard;
64 }
65 
setVariety(Variety variety)66 void XsdComplexType::ContentType::setVariety(Variety variety)
67 {
68     m_variety = variety;
69 }
70 
variety() const71 XsdComplexType::ContentType::Variety XsdComplexType::ContentType::variety() const
72 {
73     return m_variety;
74 }
75 
setParticle(const XsdParticle::Ptr & particle)76 void XsdComplexType::ContentType::setParticle(const XsdParticle::Ptr &particle)
77 {
78     m_particle = particle;
79 }
80 
particle() const81 XsdParticle::Ptr XsdComplexType::ContentType::particle() const
82 {
83     return m_particle;
84 }
85 
setOpenContent(const OpenContent::Ptr & content)86 void XsdComplexType::ContentType::setOpenContent(const OpenContent::Ptr &content)
87 {
88     m_openContent = content;
89 }
90 
openContent() const91 XsdComplexType::OpenContent::Ptr XsdComplexType::ContentType::openContent() const
92 {
93     return m_openContent;
94 }
95 
setSimpleType(const AnySimpleType::Ptr & type)96 void XsdComplexType::ContentType::setSimpleType(const AnySimpleType::Ptr &type)
97 {
98     m_simpleType = type;
99 }
100 
simpleType() const101 AnySimpleType::Ptr XsdComplexType::ContentType::simpleType() const
102 {
103     return m_simpleType;
104 }
105 
106 
XsdComplexType()107 XsdComplexType::XsdComplexType()
108     : m_isAbstract(false)
109     , m_contentType(new ContentType())
110 {
111     m_contentType->setVariety(ContentType::Empty);
112 }
113 
setIsAbstract(bool abstract)114 void XsdComplexType::setIsAbstract(bool abstract)
115 {
116     m_isAbstract = abstract;
117 }
118 
isAbstract() const119 bool XsdComplexType::isAbstract() const
120 {
121     return m_isAbstract;
122 }
123 
displayName(const NamePool::Ptr & np) const124 QString XsdComplexType::displayName(const NamePool::Ptr &np) const
125 {
126     return np->displayName(name(np));
127 }
128 
setWxsSuperType(const SchemaType::Ptr & type)129 void XsdComplexType::setWxsSuperType(const SchemaType::Ptr &type)
130 {
131     m_superType = type;
132 }
133 
wxsSuperType() const134 SchemaType::Ptr XsdComplexType::wxsSuperType() const
135 {
136     return m_superType;
137 }
138 
setContext(const NamedSchemaComponent::Ptr & component)139 void XsdComplexType::setContext(const NamedSchemaComponent::Ptr &component)
140 {
141     m_context = component;
142 }
143 
context() const144 NamedSchemaComponent::Ptr XsdComplexType::context() const
145 {
146     return m_context;
147 }
148 
setContentType(const ContentType::Ptr & type)149 void XsdComplexType::setContentType(const ContentType::Ptr &type)
150 {
151     m_contentType = type;
152 }
153 
contentType() const154 XsdComplexType::ContentType::Ptr XsdComplexType::contentType() const
155 {
156     return m_contentType;
157 }
158 
setAttributeUses(const XsdAttributeUse::List & attributeUses)159 void XsdComplexType::setAttributeUses(const XsdAttributeUse::List &attributeUses)
160 {
161     m_attributeUses = attributeUses;
162 }
163 
addAttributeUse(const XsdAttributeUse::Ptr & attributeUse)164 void XsdComplexType::addAttributeUse(const XsdAttributeUse::Ptr &attributeUse)
165 {
166     m_attributeUses.append(attributeUse);
167 }
168 
attributeUses() const169 XsdAttributeUse::List XsdComplexType::attributeUses() const
170 {
171     return m_attributeUses;
172 }
173 
setAttributeWildcard(const XsdWildcard::Ptr & wildcard)174 void XsdComplexType::setAttributeWildcard(const XsdWildcard::Ptr &wildcard)
175 {
176     m_attributeWildcard = wildcard;
177 }
178 
attributeWildcard() const179 XsdWildcard::Ptr XsdComplexType::attributeWildcard() const
180 {
181     return m_attributeWildcard;
182 }
183 
category() const184 XsdComplexType::TypeCategory XsdComplexType::category() const
185 {
186     return ComplexType;
187 }
188 
setDerivationMethod(DerivationMethod method)189 void XsdComplexType::setDerivationMethod(DerivationMethod method)
190 {
191     m_derivationMethod = method;
192 }
193 
derivationMethod() const194 XsdComplexType::DerivationMethod XsdComplexType::derivationMethod() const
195 {
196     return m_derivationMethod;
197 }
198 
setProhibitedSubstitutions(const BlockingConstraints & substitutions)199 void XsdComplexType::setProhibitedSubstitutions(const BlockingConstraints &substitutions)
200 {
201     m_prohibitedSubstitutions = substitutions;
202 }
203 
prohibitedSubstitutions() const204 XsdComplexType::BlockingConstraints XsdComplexType::prohibitedSubstitutions() const
205 {
206     return m_prohibitedSubstitutions;
207 }
208 
setAssertions(const XsdAssertion::List & assertions)209 void XsdComplexType::setAssertions(const XsdAssertion::List &assertions)
210 {
211     m_assertions = assertions;
212 }
213 
addAssertion(const XsdAssertion::Ptr & assertion)214 void XsdComplexType::addAssertion(const XsdAssertion::Ptr &assertion)
215 {
216     m_assertions.append(assertion);
217 }
218 
assertions() const219 XsdAssertion::List XsdComplexType::assertions() const
220 {
221     return m_assertions;
222 }
223 
isDefinedBySchema() const224 bool XsdComplexType::isDefinedBySchema() const
225 {
226     return true;
227 }
228 
229 QT_END_NAMESPACE
230