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 | #ifndef SYNDICATION_RDF_SEQUENCE_H |
9 | #define SYNDICATION_RDF_SEQUENCE_H |
10 | |
11 | #include "../syndication_export.h" |
12 | #include "resource.h" |
13 | |
14 | template<class T> |
15 | class QList; |
16 | |
17 | namespace Syndication |
18 | { |
19 | namespace RDF |
20 | { |
21 | //@cond PRIVATE |
22 | class Sequence; |
23 | typedef QSharedPointer<Sequence> SequencePtr; |
24 | //@endcond |
25 | |
26 | /** |
27 | * Sequence container, a sequence contains an ordered list |
28 | * of RDF nodes. (opposed to the usually unordered graph |
29 | * structure) |
30 | */ |
31 | class Sequence : public Resource |
32 | { |
33 | public: |
34 | /** |
35 | * creates a null sequence |
36 | */ |
37 | Sequence(); |
38 | |
39 | /** |
40 | * creates a sequence with the given URI. Do not use this directly, |
41 | * use Model::createSequence() instead. |
42 | */ |
43 | explicit Sequence(const QString &uri); |
44 | |
45 | /** |
46 | * copies a sequence |
47 | * |
48 | * @param other sequence |
49 | */ |
50 | Sequence(const Sequence &other); |
51 | |
52 | /** |
53 | * destructor |
54 | */ |
55 | ~Sequence() override; |
56 | |
57 | /** |
58 | * assigns another sequence |
59 | * |
60 | * @param other the sequence to assign |
61 | */ |
62 | virtual Sequence &operator=(const Sequence &other); |
63 | |
64 | /** |
65 | * Used by visitors for double dispatch. See NodeVisitor |
66 | * for more information. |
67 | * @param visitor the visitor calling the method |
68 | * @param ptr a shared pointer object for this node |
69 | */ |
70 | void accept(NodeVisitor *visitor, NodePtr ptr) override; |
71 | |
72 | /** |
73 | * creates a copy of the sequence |
74 | */ |
75 | Sequence *clone() const override; |
76 | |
77 | /** |
78 | * appends a node at the end of the sequence |
79 | * |
80 | * @param node the RDF node to append to the sequence |
81 | */ |
82 | virtual void append(NodePtr node); |
83 | |
84 | /** |
85 | * the list of the list items in the sequence, in the |
86 | * specified order |
87 | */ |
88 | virtual QList<NodePtr> items() const; |
89 | |
90 | /** |
91 | * returns @p true |
92 | */ |
93 | bool isSequence() const override; |
94 | |
95 | private: |
96 | class SequencePrivate; |
97 | QSharedPointer<SequencePrivate> d; |
98 | }; |
99 | |
100 | } // namespace RDF |
101 | } // namespace Syndication |
102 | |
103 | #endif // SYNDICATION_RDF_SEQUENCE_H |
104 | |