File indexing completed on 2023-09-24 04:15:36

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 #ifndef SYNDICATION_RDF_SEQUENCE_H
0009 #define SYNDICATION_RDF_SEQUENCE_H
0010 
0011 #include <syndication/rdf/resource.h>
0012 #include <syndication_export.h>
0013 
0014 template<class T>
0015 class QList;
0016 
0017 namespace Syndication
0018 {
0019 namespace RDF
0020 {
0021 //@cond PRIVATE
0022 class Sequence;
0023 typedef QSharedPointer<Sequence> SequencePtr;
0024 //@endcond
0025 
0026 /**
0027  * Sequence container, a sequence contains an ordered list
0028  * of RDF nodes. (opposed to the usually unordered graph
0029  * structure)
0030  */
0031 class SYNDICATION_EXPORT Sequence : public Resource
0032 {
0033 public:
0034     /**
0035      * creates a null sequence
0036      */
0037     Sequence();
0038 
0039     /**
0040      * creates a sequence with the given URI. Do not use this directly,
0041      * use Model::createSequence() instead.
0042      */
0043     explicit Sequence(const QString &uri);
0044 
0045     /**
0046      * copies a sequence
0047      *
0048      * @param other sequence
0049      */
0050     Sequence(const Sequence &other);
0051 
0052     /**
0053      * destructor
0054      */
0055     ~Sequence() override;
0056 
0057     /**
0058      * assigns another sequence
0059      *
0060      * @param other the sequence to assign
0061      */
0062     virtual Sequence &operator=(const Sequence &other);
0063 
0064     /**
0065      * Used by visitors for double dispatch. See NodeVisitor
0066      * for more information.
0067      * @param visitor the visitor calling the method
0068      * @param ptr a shared pointer object for this node
0069      */
0070     void accept(NodeVisitor *visitor, NodePtr ptr) override;
0071 
0072     /**
0073      * creates a copy of the sequence
0074      */
0075     Sequence *clone() const override;
0076 
0077     /**
0078      * appends a node at the end of the sequence
0079      *
0080      * @param node the RDF node to append to the sequence
0081      */
0082     virtual void append(NodePtr node);
0083 
0084     /**
0085      * the list of the list items in the sequence, in the
0086      * specified order
0087      */
0088     virtual QList<NodePtr> items() const;
0089 
0090     /**
0091      * returns @p true
0092      */
0093     bool isSequence() const override;
0094 
0095 private:
0096     class SequencePrivate;
0097     QSharedPointer<SequencePrivate> d;
0098 };
0099 
0100 } // namespace RDF
0101 } // namespace Syndication
0102 
0103 #endif // SYNDICATION_RDF_SEQUENCE_H