1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include "qxsdvalidatedxmlnodemodel_p.h"
44 #include <QtCore/QUrl>
45 #include <QtCore/QVariant>
46 #include <QtCore/QVector>
50 using namespace QPatternist;
52 XsdValidatedXmlNodeModel::XsdValidatedXmlNodeModel(const QAbstractXmlNodeModel *model)
53 : m_internalModel(model)
57 XsdValidatedXmlNodeModel::~XsdValidatedXmlNodeModel()
61 QUrl XsdValidatedXmlNodeModel::baseUri(const QXmlNodeModelIndex &index) const
63 return m_internalModel->baseUri(index);
66 QUrl XsdValidatedXmlNodeModel::documentUri(const QXmlNodeModelIndex &index) const
68 return m_internalModel->documentUri(index);
71 QXmlNodeModelIndex::NodeKind XsdValidatedXmlNodeModel::kind(const QXmlNodeModelIndex &index) const
73 return m_internalModel->kind(index);
76 QXmlNodeModelIndex::DocumentOrder XsdValidatedXmlNodeModel::compareOrder(const QXmlNodeModelIndex &index, const QXmlNodeModelIndex &otherIndex) const
78 return m_internalModel->compareOrder(index, otherIndex);
81 QXmlNodeModelIndex XsdValidatedXmlNodeModel::root(const QXmlNodeModelIndex &index) const
83 return m_internalModel->root(index);
86 QXmlName XsdValidatedXmlNodeModel::name(const QXmlNodeModelIndex &index) const
88 return m_internalModel->name(index);
91 QString XsdValidatedXmlNodeModel::stringValue(const QXmlNodeModelIndex &index) const
93 return m_internalModel->stringValue(index);
96 QVariant XsdValidatedXmlNodeModel::typedValue(const QXmlNodeModelIndex &index) const
98 return m_internalModel->typedValue(index);
101 QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QXmlNodeModelIndex> > XsdValidatedXmlNodeModel::iterate(const QXmlNodeModelIndex &index, QXmlNodeModelIndex::Axis axis) const
103 return m_internalModel->iterate(index, axis);
106 QPatternist::ItemIteratorPtr XsdValidatedXmlNodeModel::sequencedTypedValue(const QXmlNodeModelIndex &index) const
108 return m_internalModel->sequencedTypedValue(index);
111 QPatternist::ItemTypePtr XsdValidatedXmlNodeModel::type(const QXmlNodeModelIndex &index) const
113 return m_internalModel->type(index);
116 QXmlName::NamespaceCode XsdValidatedXmlNodeModel::namespaceForPrefix(const QXmlNodeModelIndex &index, const QXmlName::PrefixCode prefix) const
118 return m_internalModel->namespaceForPrefix(index, prefix);
121 bool XsdValidatedXmlNodeModel::isDeepEqual(const QXmlNodeModelIndex &index, const QXmlNodeModelIndex &otherIndex) const
123 return m_internalModel->isDeepEqual(index, otherIndex);
126 void XsdValidatedXmlNodeModel::sendNamespaces(const QXmlNodeModelIndex &index, QAbstractXmlReceiver *const receiver) const
128 m_internalModel->sendNamespaces(index, receiver);
131 QVector<QXmlName> XsdValidatedXmlNodeModel::namespaceBindings(const QXmlNodeModelIndex &index) const
133 return m_internalModel->namespaceBindings(index);
136 QXmlNodeModelIndex XsdValidatedXmlNodeModel::elementById(const QXmlName &name) const
138 return m_internalModel->elementById(name);
141 QVector<QXmlNodeModelIndex> XsdValidatedXmlNodeModel::nodesByIdref(const QXmlName &name) const
143 return m_internalModel->nodesByIdref(name);
146 void XsdValidatedXmlNodeModel::copyNodeTo(const QXmlNodeModelIndex &index, QAbstractXmlReceiver *const receiver, const NodeCopySettings &settings) const
148 return m_internalModel->copyNodeTo(index, receiver, settings);
151 QXmlNodeModelIndex XsdValidatedXmlNodeModel::nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const
153 return m_internalModel->nextFromSimpleAxis(axis, origin);
156 QVector<QXmlNodeModelIndex> XsdValidatedXmlNodeModel::attributes(const QXmlNodeModelIndex &index) const
158 return m_internalModel->attributes(index);
161 void XsdValidatedXmlNodeModel::setAssignedElement(const QXmlNodeModelIndex &index, const XsdElement::Ptr &element)
163 m_assignedElements.insert(index, element);
166 XsdElement::Ptr XsdValidatedXmlNodeModel::assignedElement(const QXmlNodeModelIndex &index) const
168 if (m_assignedElements.contains(index))
169 return m_assignedElements.value(index);
171 return XsdElement::Ptr();
174 void XsdValidatedXmlNodeModel::setAssignedAttribute(const QXmlNodeModelIndex &index, const XsdAttribute::Ptr &attribute)
176 m_assignedAttributes.insert(index, attribute);
179 XsdAttribute::Ptr XsdValidatedXmlNodeModel::assignedAttribute(const QXmlNodeModelIndex &index) const
181 if (m_assignedAttributes.contains(index))
182 return m_assignedAttributes.value(index);
184 return XsdAttribute::Ptr();
187 void XsdValidatedXmlNodeModel::setAssignedType(const QXmlNodeModelIndex &index, const SchemaType::Ptr &type)
189 m_assignedTypes.insert(index, type);
192 SchemaType::Ptr XsdValidatedXmlNodeModel::assignedType(const QXmlNodeModelIndex &index) const
194 if (m_assignedTypes.contains(index))
195 return m_assignedTypes.value(index);
197 return SchemaType::Ptr();
200 void XsdValidatedXmlNodeModel::addIdIdRefBinding(const QString &id, const NamedSchemaComponent::Ptr &binding)
202 m_idIdRefBindings[id].insert(binding);
205 QStringList XsdValidatedXmlNodeModel::idIdRefBindingIds() const
207 return m_idIdRefBindings.keys();
210 QSet<NamedSchemaComponent::Ptr> XsdValidatedXmlNodeModel::idIdRefBindings(const QString &id) const
212 return m_idIdRefBindings.value(id);