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 "qxsdelement_p.h"
43 
44 QT_BEGIN_NAMESPACE
45 
46 using namespace QPatternist;
47 
setVariety(Variety variety)48 void XsdElement::Scope::setVariety(Variety variety)
49 {
50     m_variety = variety;
51 }
52 
variety() const53 XsdElement::Scope::Variety XsdElement::Scope::variety() const
54 {
55     return m_variety;
56 }
57 
setParent(const NamedSchemaComponent::Ptr & parent)58 void XsdElement::Scope::setParent(const NamedSchemaComponent::Ptr &parent)
59 {
60     m_parent = parent.data();
61 }
62 
parent() const63 NamedSchemaComponent::Ptr XsdElement::Scope::parent() const
64 {
65     return NamedSchemaComponent::Ptr(m_parent);
66 }
67 
setVariety(Variety variety)68 void XsdElement::ValueConstraint::setVariety(Variety variety)
69 {
70     m_variety = variety;
71 }
72 
variety() const73 XsdElement::ValueConstraint::Variety XsdElement::ValueConstraint::variety() const
74 {
75     return m_variety;
76 }
77 
setValue(const QString & value)78 void XsdElement::ValueConstraint::setValue(const QString &value)
79 {
80     m_value = value;
81 }
82 
value() const83 QString XsdElement::ValueConstraint::value() const
84 {
85     return m_value;
86 }
87 
setLexicalForm(const QString & form)88 void XsdElement::ValueConstraint::setLexicalForm(const QString &form)
89 {
90     m_lexicalForm = form;
91 }
92 
lexicalForm() const93 QString XsdElement::ValueConstraint::lexicalForm() const
94 {
95     return m_lexicalForm;
96 }
97 
addAlternative(const XsdAlternative::Ptr & alternative)98 void XsdElement::TypeTable::addAlternative(const XsdAlternative::Ptr &alternative)
99 {
100     m_alternatives.append(alternative);
101 }
102 
alternatives() const103 XsdAlternative::List XsdElement::TypeTable::alternatives() const
104 {
105     return m_alternatives;
106 }
107 
setDefaultTypeDefinition(const XsdAlternative::Ptr & type)108 void XsdElement::TypeTable::setDefaultTypeDefinition(const XsdAlternative::Ptr &type)
109 {
110     m_defaultTypeDefinition = type;
111 }
112 
defaultTypeDefinition() const113 XsdAlternative::Ptr XsdElement::TypeTable::defaultTypeDefinition() const
114 {
115     return m_defaultTypeDefinition;
116 }
117 
118 
XsdElement()119 XsdElement::XsdElement()
120     : m_isAbstract(false)
121 {
122 }
123 
isElement() const124 bool XsdElement::isElement() const
125 {
126     return true;
127 }
128 
setType(const SchemaType::Ptr & type)129 void XsdElement::setType(const SchemaType::Ptr &type)
130 {
131     m_type = type.data();
132 }
133 
type() const134 SchemaType::Ptr XsdElement::type() const
135 {
136     return SchemaType::Ptr(m_type);
137 }
138 
setScope(const Scope::Ptr & scope)139 void XsdElement::setScope(const Scope::Ptr &scope)
140 {
141     m_scope = scope;
142 }
143 
scope() const144 XsdElement::Scope::Ptr XsdElement::scope() const
145 {
146     return m_scope;
147 }
148 
setValueConstraint(const ValueConstraint::Ptr & constraint)149 void XsdElement::setValueConstraint(const ValueConstraint::Ptr &constraint)
150 {
151     m_valueConstraint = constraint;
152 }
153 
valueConstraint() const154 XsdElement::ValueConstraint::Ptr XsdElement::valueConstraint() const
155 {
156     return m_valueConstraint;
157 }
158 
setTypeTable(const TypeTable::Ptr & table)159 void XsdElement::setTypeTable(const TypeTable::Ptr &table)
160 {
161     m_typeTable = table;
162 }
163 
typeTable() const164 XsdElement::TypeTable::Ptr XsdElement::typeTable() const
165 {
166     return m_typeTable;
167 }
168 
setIsAbstract(bool abstract)169 void XsdElement::setIsAbstract(bool abstract)
170 {
171     m_isAbstract = abstract;
172 }
173 
isAbstract() const174 bool XsdElement::isAbstract() const
175 {
176     return m_isAbstract;
177 }
178 
setIsNillable(bool nillable)179 void XsdElement::setIsNillable(bool nillable)
180 {
181     m_isNillable = nillable;
182 }
183 
isNillable() const184 bool XsdElement::isNillable() const
185 {
186     return m_isNillable;
187 }
188 
setDisallowedSubstitutions(const BlockingConstraints & substitutions)189 void XsdElement::setDisallowedSubstitutions(const BlockingConstraints &substitutions)
190 {
191     m_disallowedSubstitutions = substitutions;
192 }
193 
disallowedSubstitutions() const194 XsdElement::BlockingConstraints XsdElement::disallowedSubstitutions() const
195 {
196     return m_disallowedSubstitutions;
197 }
198 
setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints & exclusions)199 void XsdElement::setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints &exclusions)
200 {
201     m_substitutionGroupExclusions = exclusions;
202 }
203 
substitutionGroupExclusions() const204 SchemaType::DerivationConstraints XsdElement::substitutionGroupExclusions() const
205 {
206     return m_substitutionGroupExclusions;
207 }
208 
setIdentityConstraints(const XsdIdentityConstraint::List & constraints)209 void XsdElement::setIdentityConstraints(const XsdIdentityConstraint::List &constraints)
210 {
211     m_identityConstraints = constraints;
212 }
213 
addIdentityConstraint(const XsdIdentityConstraint::Ptr & constraint)214 void XsdElement::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint)
215 {
216     m_identityConstraints.append(constraint);
217 }
218 
identityConstraints() const219 XsdIdentityConstraint::List XsdElement::identityConstraints() const
220 {
221     return m_identityConstraints;
222 }
223 
setSubstitutionGroupAffiliations(const XsdElement::List & affiliations)224 void XsdElement::setSubstitutionGroupAffiliations(const XsdElement::List &affiliations)
225 {
226     m_substitutionGroupAffiliations = affiliations;
227 }
228 
substitutionGroupAffiliations() const229 XsdElement::List XsdElement::substitutionGroupAffiliations() const
230 {
231     return m_substitutionGroupAffiliations;
232 }
233 
addSubstitutionGroup(const XsdElement::Ptr & element)234 void XsdElement::addSubstitutionGroup(const XsdElement::Ptr &element)
235 {
236     m_substitutionGroups.insert(element.data());
237 }
238 
substitutionGroups() const239 XsdElement::WeakList XsdElement::substitutionGroups() const
240 {
241     return m_substitutionGroups.toList();
242 }
243 
244 QT_END_NAMESPACE
245