File indexing completed on 2024-04-21 04:01:00

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_ATOM_SOURCE_H
0009 #define SYNDICATION_ATOM_SOURCE_H
0010 
0011 #include <syndication/elementwrapper.h>
0012 
0013 #include <ctime>
0014 
0015 class QDomElement;
0016 class QString;
0017 
0018 template<class T>
0019 class QList;
0020 
0021 namespace Syndication
0022 {
0023 namespace Atom
0024 {
0025 class Category;
0026 class Generator;
0027 class Link;
0028 class Person;
0029 
0030 /**
0031  * If an entry was copied from another feed, this class contains
0032  * a description of the source feed.
0033  *
0034  * @author Frank Osterfeld
0035  */
0036 class SYNDICATION_EXPORT Source : public ElementWrapper
0037 {
0038 public:
0039     /**
0040      * creates a null source object
0041      */
0042     Source();
0043 
0044     /**
0045      * creates a Source object wrapping a atom:source element.
0046      *
0047      * @param element a DOM element, should be a atom:source element
0048      * (although not enforced), otherwise this object will not parse
0049      * anything useful
0050      */
0051     explicit Source(const QDomElement &element);
0052 
0053     /**
0054      * authors of the original content (optional)
0055      */
0056     Q_REQUIRED_RESULT QList<Person> authors() const;
0057 
0058     /**
0059      * contributors to the original content (optional)
0060      */
0061     Q_REQUIRED_RESULT QList<Person> contributors() const;
0062 
0063     /**
0064      * categories the source feed is assigned to (optional)
0065      */
0066     Q_REQUIRED_RESULT QList<Category> categories() const;
0067 
0068     /**
0069      * description of the software which generated the source feed
0070      * (optional)
0071      */
0072     Q_REQUIRED_RESULT Generator generator() const;
0073 
0074     /**
0075      * URL of an image serving as a feed icon (optional)
0076      *
0077      * @return icon URL, or a null string if not specified
0078      */
0079     Q_REQUIRED_RESULT QString icon() const;
0080 
0081     /**
0082      * a string that unambiguously identifies the source feed (optional)
0083      *
0084      * @return the ID of the source feed, or a null string if not
0085      * specified.
0086      */
0087     Q_REQUIRED_RESULT QString id() const;
0088 
0089     /**
0090      * a list of links. See Link for more information on
0091      * link types.
0092      */
0093     Q_REQUIRED_RESULT QList<Link> links() const;
0094 
0095     /**
0096      * URL of an image, the logo of the source feed (optional)
0097      *
0098      * @return image URL, or a null string if not specified in the feed.
0099      */
0100     Q_REQUIRED_RESULT QString logo() const;
0101 
0102     /**
0103      * copyright information (optional)
0104      *
0105      * @return copyright information for the source,
0106      * or a null string if not specified
0107      */
0108     Q_REQUIRED_RESULT QString rights() const;
0109 
0110     /**
0111      * description or subtitle of the source feed (optional).
0112      *
0113      * @return subtitle string as HTML, or a null string
0114      * if not specified.
0115      */
0116     Q_REQUIRED_RESULT QString subtitle() const;
0117 
0118     /**
0119      * source feed title (optional).
0120      *
0121      * @return title string as HTML, or a null string if not specified
0122      */
0123     Q_REQUIRED_RESULT QString title() const;
0124 
0125     /**
0126      * The datetime of the last modification of the source feed
0127      * content. (optional)
0128      *
0129      * @return the modification date in seconds since epoch
0130      */
0131     Q_REQUIRED_RESULT time_t updated() const;
0132 
0133     /**
0134      * description of this source object for debugging purposes
0135      *
0136      * @return debug string
0137      */
0138     Q_REQUIRED_RESULT QString debugInfo() const;
0139 };
0140 
0141 } // namespace Atom
0142 } // namespace Syndication
0143 
0144 #endif // SYNDICATION_ATOM_SOURCE_H