1 | /* |
---|---|
2 | This file is part of the syndication library |
3 | SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #include "sequence.h" |
9 | #include "node.h" |
10 | #include "nodevisitor.h" |
11 | |
12 | #include <QList> |
13 | #include <QString> |
14 | |
15 | namespace Syndication |
16 | { |
17 | namespace RDF |
18 | { |
19 | class SYNDICATION_NO_EXPORT Sequence::SequencePrivate |
20 | { |
21 | public: |
22 | QList<NodePtr> items; |
23 | }; |
24 | |
25 | Sequence::Sequence() |
26 | : Resource() |
27 | , d() |
28 | { |
29 | } |
30 | |
31 | Sequence::Sequence(const QString &uri) |
32 | : Resource(uri) |
33 | , d(new SequencePrivate) |
34 | { |
35 | } |
36 | |
37 | Sequence::Sequence(const Sequence &other) |
38 | : Resource(other) |
39 | { |
40 | *this = other; |
41 | } |
42 | |
43 | Sequence::~Sequence() |
44 | { |
45 | } |
46 | void Sequence::accept(NodeVisitor *visitor, NodePtr ptr) |
47 | { |
48 | SequencePtr sptr = ptr.staticCast<Sequence>(); |
49 | if (!visitor->visitSequence(seq: sptr)) { |
50 | Resource::accept(visitor, ptr); |
51 | } |
52 | } |
53 | |
54 | Sequence *Sequence::clone() const |
55 | { |
56 | return new Sequence(*this); |
57 | } |
58 | |
59 | Sequence &Sequence::operator=(const Sequence &other) |
60 | { |
61 | Resource::operator=(other); |
62 | d = other.d; |
63 | return *this; |
64 | } |
65 | |
66 | void Sequence::append(NodePtr node) |
67 | { |
68 | if (d) { |
69 | d->items.append(t: node); |
70 | } |
71 | } |
72 | |
73 | QList<NodePtr> Sequence::items() const |
74 | { |
75 | return d ? d->items : QList<NodePtr>(); |
76 | } |
77 | |
78 | bool Sequence::isSequence() const |
79 | { |
80 | return true; |
81 | } |
82 | |
83 | } // namespace RDF |
84 | } // namespace Syndication |
85 |