src/xmlpatterns/schema/qxsdvalidatedxmlnodemodel.cpp
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     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 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    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 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include "qxsdvalidatedxmlnodemodel_p.h"
       
    43 
       
    44 #include <QtCore/QUrl>
       
    45 #include <QtCore/QVariant>
       
    46 #include <QtCore/QVector>
       
    47 
       
    48 QT_BEGIN_NAMESPACE
       
    49 
       
    50 using namespace QPatternist;
       
    51 
       
    52 XsdValidatedXmlNodeModel::XsdValidatedXmlNodeModel(const QAbstractXmlNodeModel *model)
       
    53     : m_internalModel(model)
       
    54 {
       
    55 }
       
    56 
       
    57 XsdValidatedXmlNodeModel::~XsdValidatedXmlNodeModel()
       
    58 {
       
    59 }
       
    60 
       
    61 QUrl XsdValidatedXmlNodeModel::baseUri(const QXmlNodeModelIndex &index) const
       
    62 {
       
    63     return m_internalModel->baseUri(index);
       
    64 }
       
    65 
       
    66 QUrl XsdValidatedXmlNodeModel::documentUri(const QXmlNodeModelIndex &index) const
       
    67 {
       
    68     return m_internalModel->documentUri(index);
       
    69 }
       
    70 
       
    71 QXmlNodeModelIndex::NodeKind XsdValidatedXmlNodeModel::kind(const QXmlNodeModelIndex &index) const
       
    72 {
       
    73     return m_internalModel->kind(index);
       
    74 }
       
    75 
       
    76 QXmlNodeModelIndex::DocumentOrder XsdValidatedXmlNodeModel::compareOrder(const QXmlNodeModelIndex &index, const QXmlNodeModelIndex &otherIndex) const
       
    77 {
       
    78     return m_internalModel->compareOrder(index, otherIndex);
       
    79 }
       
    80 
       
    81 QXmlNodeModelIndex XsdValidatedXmlNodeModel::root(const QXmlNodeModelIndex &index) const
       
    82 {
       
    83     return m_internalModel->root(index);
       
    84 }
       
    85 
       
    86 QXmlName XsdValidatedXmlNodeModel::name(const QXmlNodeModelIndex &index) const
       
    87 {
       
    88     return m_internalModel->name(index);
       
    89 }
       
    90 
       
    91 QString XsdValidatedXmlNodeModel::stringValue(const QXmlNodeModelIndex &index) const
       
    92 {
       
    93     return m_internalModel->stringValue(index);
       
    94 }
       
    95 
       
    96 QVariant XsdValidatedXmlNodeModel::typedValue(const QXmlNodeModelIndex &index) const
       
    97 {
       
    98     return m_internalModel->typedValue(index);
       
    99 }
       
   100 
       
   101 QExplicitlySharedDataPointer<QAbstractXmlForwardIterator<QXmlNodeModelIndex> > XsdValidatedXmlNodeModel::iterate(const QXmlNodeModelIndex &index, QXmlNodeModelIndex::Axis axis) const
       
   102 {
       
   103     return m_internalModel->iterate(index, axis);
       
   104 }
       
   105 
       
   106 QPatternist::ItemIteratorPtr XsdValidatedXmlNodeModel::sequencedTypedValue(const QXmlNodeModelIndex &index) const
       
   107 {
       
   108     return m_internalModel->sequencedTypedValue(index);
       
   109 }
       
   110 
       
   111 QPatternist::ItemTypePtr XsdValidatedXmlNodeModel::type(const QXmlNodeModelIndex &index) const
       
   112 {
       
   113     return m_internalModel->type(index);
       
   114 }
       
   115 
       
   116 QXmlName::NamespaceCode XsdValidatedXmlNodeModel::namespaceForPrefix(const QXmlNodeModelIndex &index, const QXmlName::PrefixCode prefix) const
       
   117 {
       
   118     return m_internalModel->namespaceForPrefix(index, prefix);
       
   119 }
       
   120 
       
   121 bool XsdValidatedXmlNodeModel::isDeepEqual(const QXmlNodeModelIndex &index, const QXmlNodeModelIndex &otherIndex) const
       
   122 {
       
   123     return m_internalModel->isDeepEqual(index, otherIndex);
       
   124 }
       
   125 
       
   126 void XsdValidatedXmlNodeModel::sendNamespaces(const QXmlNodeModelIndex &index, QAbstractXmlReceiver *const receiver) const
       
   127 {
       
   128     m_internalModel->sendNamespaces(index, receiver);
       
   129 }
       
   130 
       
   131 QVector<QXmlName> XsdValidatedXmlNodeModel::namespaceBindings(const QXmlNodeModelIndex &index) const
       
   132 {
       
   133     return m_internalModel->namespaceBindings(index);
       
   134 }
       
   135 
       
   136 QXmlNodeModelIndex XsdValidatedXmlNodeModel::elementById(const QXmlName &name) const
       
   137 {
       
   138     return m_internalModel->elementById(name);
       
   139 }
       
   140 
       
   141 QVector<QXmlNodeModelIndex> XsdValidatedXmlNodeModel::nodesByIdref(const QXmlName &name) const
       
   142 {
       
   143     return m_internalModel->nodesByIdref(name);
       
   144 }
       
   145 
       
   146 void XsdValidatedXmlNodeModel::copyNodeTo(const QXmlNodeModelIndex &index, QAbstractXmlReceiver *const receiver, const NodeCopySettings &settings) const
       
   147 {
       
   148     return m_internalModel->copyNodeTo(index, receiver, settings);
       
   149 }
       
   150 
       
   151 QXmlNodeModelIndex XsdValidatedXmlNodeModel::nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &origin) const
       
   152 {
       
   153     return m_internalModel->nextFromSimpleAxis(axis, origin);
       
   154 }
       
   155 
       
   156 QVector<QXmlNodeModelIndex> XsdValidatedXmlNodeModel::attributes(const QXmlNodeModelIndex &index) const
       
   157 {
       
   158     return m_internalModel->attributes(index);
       
   159 }
       
   160 
       
   161 void XsdValidatedXmlNodeModel::setAssignedElement(const QXmlNodeModelIndex &index, const XsdElement::Ptr &element)
       
   162 {
       
   163     m_assignedElements.insert(index, element);
       
   164 }
       
   165 
       
   166 XsdElement::Ptr XsdValidatedXmlNodeModel::assignedElement(const QXmlNodeModelIndex &index) const
       
   167 {
       
   168     if (m_assignedElements.contains(index))
       
   169         return m_assignedElements.value(index);
       
   170     else
       
   171         return XsdElement::Ptr();
       
   172 }
       
   173 
       
   174 void XsdValidatedXmlNodeModel::setAssignedAttribute(const QXmlNodeModelIndex &index, const XsdAttribute::Ptr &attribute)
       
   175 {
       
   176     m_assignedAttributes.insert(index, attribute);
       
   177 }
       
   178 
       
   179 XsdAttribute::Ptr XsdValidatedXmlNodeModel::assignedAttribute(const QXmlNodeModelIndex &index) const
       
   180 {
       
   181     if (m_assignedAttributes.contains(index))
       
   182         return m_assignedAttributes.value(index);
       
   183     else
       
   184         return XsdAttribute::Ptr();
       
   185 }
       
   186 
       
   187 void XsdValidatedXmlNodeModel::setAssignedType(const QXmlNodeModelIndex &index, const SchemaType::Ptr &type)
       
   188 {
       
   189     m_assignedTypes.insert(index, type);
       
   190 }
       
   191 
       
   192 SchemaType::Ptr XsdValidatedXmlNodeModel::assignedType(const QXmlNodeModelIndex &index) const
       
   193 {
       
   194     if (m_assignedTypes.contains(index))
       
   195         return m_assignedTypes.value(index);
       
   196     else
       
   197         return SchemaType::Ptr();
       
   198 }
       
   199 
       
   200 void XsdValidatedXmlNodeModel::addIdIdRefBinding(const QString &id, const NamedSchemaComponent::Ptr &binding)
       
   201 {
       
   202     m_idIdRefBindings[id].insert(binding);
       
   203 }
       
   204 
       
   205 QStringList XsdValidatedXmlNodeModel::idIdRefBindingIds() const
       
   206 {
       
   207     return m_idIdRefBindings.keys();
       
   208 }
       
   209 
       
   210 QSet<NamedSchemaComponent::Ptr> XsdValidatedXmlNodeModel::idIdRefBindings(const QString &id) const
       
   211 {
       
   212     return m_idIdRefBindings.value(id);
       
   213 }
       
   214 
       
   215 QT_END_NAMESPACE