| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** All rights reserved. | 
|---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com) | 
|---|
| 6 | ** | 
|---|
| 7 | ** This file is part of the QtXmlPatterns module of the Qt Toolkit. | 
|---|
| 8 | ** | 
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 10 | ** Commercial Usage | 
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 14 | ** a written agreement between you and Nokia. | 
|---|
| 15 | ** | 
|---|
| 16 | ** GNU Lesser General Public License Usage | 
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 20 | ** packaging of this file.  Please review the following information to | 
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 23 | ** | 
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional | 
|---|
| 25 | ** rights.  These rights are described in the Nokia Qt LGPL Exception | 
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you have questions regarding the use of this file, please contact | 
|---|
| 37 | ** Nokia at qt-info@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #include "qxsdelement_p.h" | 
|---|
| 43 |  | 
|---|
| 44 | QT_BEGIN_NAMESPACE | 
|---|
| 45 |  | 
|---|
| 46 | using namespace QPatternist; | 
|---|
| 47 |  | 
|---|
| 48 | void XsdElement::Scope::setVariety(Variety variety) | 
|---|
| 49 | { | 
|---|
| 50 | m_variety = variety; | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | XsdElement::Scope::Variety XsdElement::Scope::variety() const | 
|---|
| 54 | { | 
|---|
| 55 | return m_variety; | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | void XsdElement::Scope::setParent(const NamedSchemaComponent::Ptr &parent) | 
|---|
| 59 | { | 
|---|
| 60 | m_parent = parent; | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | NamedSchemaComponent::Ptr XsdElement::Scope::parent() const | 
|---|
| 64 | { | 
|---|
| 65 | return m_parent; | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | void XsdElement::ValueConstraint::setVariety(Variety variety) | 
|---|
| 69 | { | 
|---|
| 70 | m_variety = variety; | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 | XsdElement::ValueConstraint::Variety XsdElement::ValueConstraint::variety() const | 
|---|
| 74 | { | 
|---|
| 75 | return m_variety; | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|
| 78 | void XsdElement::ValueConstraint::setValue(const QString &value) | 
|---|
| 79 | { | 
|---|
| 80 | m_value = value; | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | QString XsdElement::ValueConstraint::value() const | 
|---|
| 84 | { | 
|---|
| 85 | return m_value; | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | void XsdElement::ValueConstraint::setLexicalForm(const QString &form) | 
|---|
| 89 | { | 
|---|
| 90 | m_lexicalForm = form; | 
|---|
| 91 | } | 
|---|
| 92 |  | 
|---|
| 93 | QString XsdElement::ValueConstraint::lexicalForm() const | 
|---|
| 94 | { | 
|---|
| 95 | return m_lexicalForm; | 
|---|
| 96 | } | 
|---|
| 97 |  | 
|---|
| 98 | void XsdElement::TypeTable::addAlternative(const XsdAlternative::Ptr &alternative) | 
|---|
| 99 | { | 
|---|
| 100 | m_alternatives.append(alternative); | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | XsdAlternative::List XsdElement::TypeTable::alternatives() const | 
|---|
| 104 | { | 
|---|
| 105 | return m_alternatives; | 
|---|
| 106 | } | 
|---|
| 107 |  | 
|---|
| 108 | void XsdElement::TypeTable::setDefaultTypeDefinition(const XsdAlternative::Ptr &type) | 
|---|
| 109 | { | 
|---|
| 110 | m_defaultTypeDefinition = type; | 
|---|
| 111 | } | 
|---|
| 112 |  | 
|---|
| 113 | XsdAlternative::Ptr XsdElement::TypeTable::defaultTypeDefinition() const | 
|---|
| 114 | { | 
|---|
| 115 | return m_defaultTypeDefinition; | 
|---|
| 116 | } | 
|---|
| 117 |  | 
|---|
| 118 |  | 
|---|
| 119 | XsdElement::XsdElement() | 
|---|
| 120 | : m_isAbstract(false) | 
|---|
| 121 | { | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 | bool XsdElement::isElement() const | 
|---|
| 125 | { | 
|---|
| 126 | return true; | 
|---|
| 127 | } | 
|---|
| 128 |  | 
|---|
| 129 | void XsdElement::setType(const SchemaType::Ptr &type) | 
|---|
| 130 | { | 
|---|
| 131 | m_type = type; | 
|---|
| 132 | } | 
|---|
| 133 |  | 
|---|
| 134 | SchemaType::Ptr XsdElement::type() const | 
|---|
| 135 | { | 
|---|
| 136 | return m_type; | 
|---|
| 137 | } | 
|---|
| 138 |  | 
|---|
| 139 | void XsdElement::setScope(const Scope::Ptr &scope) | 
|---|
| 140 | { | 
|---|
| 141 | m_scope = scope; | 
|---|
| 142 | } | 
|---|
| 143 |  | 
|---|
| 144 | XsdElement::Scope::Ptr XsdElement::scope() const | 
|---|
| 145 | { | 
|---|
| 146 | return m_scope; | 
|---|
| 147 | } | 
|---|
| 148 |  | 
|---|
| 149 | void XsdElement::setValueConstraint(const ValueConstraint::Ptr &constraint) | 
|---|
| 150 | { | 
|---|
| 151 | m_valueConstraint = constraint; | 
|---|
| 152 | } | 
|---|
| 153 |  | 
|---|
| 154 | XsdElement::ValueConstraint::Ptr XsdElement::valueConstraint() const | 
|---|
| 155 | { | 
|---|
| 156 | return m_valueConstraint; | 
|---|
| 157 | } | 
|---|
| 158 |  | 
|---|
| 159 | void XsdElement::setTypeTable(const TypeTable::Ptr &table) | 
|---|
| 160 | { | 
|---|
| 161 | m_typeTable = table; | 
|---|
| 162 | } | 
|---|
| 163 |  | 
|---|
| 164 | XsdElement::TypeTable::Ptr XsdElement::typeTable() const | 
|---|
| 165 | { | 
|---|
| 166 | return m_typeTable; | 
|---|
| 167 | } | 
|---|
| 168 |  | 
|---|
| 169 | void XsdElement::setIsAbstract(bool abstract) | 
|---|
| 170 | { | 
|---|
| 171 | m_isAbstract = abstract; | 
|---|
| 172 | } | 
|---|
| 173 |  | 
|---|
| 174 | bool XsdElement::isAbstract() const | 
|---|
| 175 | { | 
|---|
| 176 | return m_isAbstract; | 
|---|
| 177 | } | 
|---|
| 178 |  | 
|---|
| 179 | void XsdElement::setIsNillable(bool nillable) | 
|---|
| 180 | { | 
|---|
| 181 | m_isNillable = nillable; | 
|---|
| 182 | } | 
|---|
| 183 |  | 
|---|
| 184 | bool XsdElement::isNillable() const | 
|---|
| 185 | { | 
|---|
| 186 | return m_isNillable; | 
|---|
| 187 | } | 
|---|
| 188 |  | 
|---|
| 189 | void XsdElement::setDisallowedSubstitutions(const BlockingConstraints &substitutions) | 
|---|
| 190 | { | 
|---|
| 191 | m_disallowedSubstitutions = substitutions; | 
|---|
| 192 | } | 
|---|
| 193 |  | 
|---|
| 194 | XsdElement::BlockingConstraints XsdElement::disallowedSubstitutions() const | 
|---|
| 195 | { | 
|---|
| 196 | return m_disallowedSubstitutions; | 
|---|
| 197 | } | 
|---|
| 198 |  | 
|---|
| 199 | void XsdElement::setSubstitutionGroupExclusions(const SchemaType::DerivationConstraints &exclusions) | 
|---|
| 200 | { | 
|---|
| 201 | m_substitutionGroupExclusions = exclusions; | 
|---|
| 202 | } | 
|---|
| 203 |  | 
|---|
| 204 | SchemaType::DerivationConstraints XsdElement::substitutionGroupExclusions() const | 
|---|
| 205 | { | 
|---|
| 206 | return m_substitutionGroupExclusions; | 
|---|
| 207 | } | 
|---|
| 208 |  | 
|---|
| 209 | void XsdElement::setIdentityConstraints(const XsdIdentityConstraint::List &constraints) | 
|---|
| 210 | { | 
|---|
| 211 | m_identityConstraints = constraints; | 
|---|
| 212 | } | 
|---|
| 213 |  | 
|---|
| 214 | void XsdElement::addIdentityConstraint(const XsdIdentityConstraint::Ptr &constraint) | 
|---|
| 215 | { | 
|---|
| 216 | m_identityConstraints.append(constraint); | 
|---|
| 217 | } | 
|---|
| 218 |  | 
|---|
| 219 | XsdIdentityConstraint::List XsdElement::identityConstraints() const | 
|---|
| 220 | { | 
|---|
| 221 | return m_identityConstraints; | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|
| 224 | void XsdElement::setSubstitutionGroupAffiliations(const XsdElement::List &affiliations) | 
|---|
| 225 | { | 
|---|
| 226 | m_substitutionGroupAffiliations = affiliations; | 
|---|
| 227 | } | 
|---|
| 228 |  | 
|---|
| 229 | XsdElement::List XsdElement::substitutionGroupAffiliations() const | 
|---|
| 230 | { | 
|---|
| 231 | return m_substitutionGroupAffiliations; | 
|---|
| 232 | } | 
|---|
| 233 |  | 
|---|
| 234 | void XsdElement::addSubstitutionGroup(const XsdElement::Ptr &element) | 
|---|
| 235 | { | 
|---|
| 236 | m_substitutionGroups.insert(element); | 
|---|
| 237 | } | 
|---|
| 238 |  | 
|---|
| 239 | XsdElement::List XsdElement::substitutionGroups() const | 
|---|
| 240 | { | 
|---|
| 241 | return m_substitutionGroups.toList(); | 
|---|
| 242 | } | 
|---|
| 243 |  | 
|---|
| 244 | QT_END_NAMESPACE | 
|---|