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