File indexing completed on 2024-09-01 03:51:05
0001 /* 0002 This file is part of the syndication library 0003 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "sequence.h" 0009 #include "node.h" 0010 #include "nodevisitor.h" 0011 0012 #include <QList> 0013 #include <QString> 0014 0015 namespace Syndication 0016 { 0017 namespace RDF 0018 { 0019 class SYNDICATION_NO_EXPORT Sequence::SequencePrivate 0020 { 0021 public: 0022 QList<NodePtr> items; 0023 }; 0024 0025 Sequence::Sequence() 0026 : Resource() 0027 , d() 0028 { 0029 } 0030 0031 Sequence::Sequence(const QString &uri) 0032 : Resource(uri) 0033 , d(new SequencePrivate) 0034 { 0035 } 0036 0037 Sequence::Sequence(const Sequence &other) 0038 : Resource(other) 0039 { 0040 *this = other; 0041 } 0042 0043 Sequence::~Sequence() 0044 { 0045 } 0046 void Sequence::accept(NodeVisitor *visitor, NodePtr ptr) 0047 { 0048 SequencePtr sptr = ptr.staticCast<Sequence>(); 0049 if (!visitor->visitSequence(sptr)) { 0050 Resource::accept(visitor, ptr); 0051 } 0052 } 0053 0054 Sequence *Sequence::clone() const 0055 { 0056 return new Sequence(*this); 0057 } 0058 0059 Sequence &Sequence::operator=(const Sequence &other) 0060 { 0061 Resource::operator=(other); 0062 d = other.d; 0063 return *this; 0064 } 0065 0066 void Sequence::append(NodePtr node) 0067 { 0068 if (d) { 0069 d->items.append(node); 0070 } 0071 } 0072 0073 QList<NodePtr> Sequence::items() const 0074 { 0075 return d ? d->items : QList<NodePtr>(); 0076 } 0077 0078 bool Sequence::isSequence() const 0079 { 0080 return true; 0081 } 0082 0083 } // namespace RDF 0084 } // namespace Syndication