| 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_ENCLOSURE_H |
| 9 | #define SYNDICATION_ENCLOSURE_H |
| 10 | |
| 11 | #include "syndication_export.h" |
| 12 | |
| 13 | #include <QSharedPointer> |
| 14 | #include <QString> |
| 15 | |
| 16 | namespace Syndication |
| 17 | { |
| 18 | class Enclosure; |
| 19 | typedef QSharedPointer<Enclosure> EnclosurePtr; |
| 20 | |
| 21 | /*! |
| 22 | * \class Syndication::Enclosure |
| 23 | * \inmodule Syndication |
| 24 | * \inheaderfile Syndication/Enclosure |
| 25 | * |
| 26 | * \brief An enclosure describes a (media) file available on the net. |
| 27 | * |
| 28 | * Most of the time, enclosures are used for "podcasts", i.e. audio |
| 29 | * files announced and distributed via syndication. |
| 30 | */ |
| 31 | class SYNDICATION_EXPORT Enclosure |
| 32 | { |
| 33 | public: |
| 34 | virtual ~Enclosure(); |
| 35 | |
| 36 | /*! |
| 37 | * returns whether this enclosure is a null object. |
| 38 | */ |
| 39 | virtual bool isNull() const = 0; |
| 40 | |
| 41 | /*! |
| 42 | * The URL of the linked resource (required). |
| 43 | */ |
| 44 | virtual QString url() const = 0; |
| 45 | |
| 46 | /*! |
| 47 | * title of the enclosure. This is a human-readable description of the |
| 48 | * linked file. If available, the title should be used in user interfaces |
| 49 | * instead of the URL. If no title is set (e.g., RSS2 enclosures don't |
| 50 | * have titles), use url() as fallback. |
| 51 | */ |
| 52 | virtual QString title() const = 0; |
| 53 | |
| 54 | /*! |
| 55 | * MIME type of the enclosure. |
| 56 | * |
| 57 | * Examples are "audio/mpeg" for MP3, or "application/pdf" for |
| 58 | * PDF. |
| 59 | */ |
| 60 | virtual QString type() const = 0; |
| 61 | |
| 62 | /*! |
| 63 | * returns the length of the linked file in bytes |
| 64 | */ |
| 65 | virtual uint length() const = 0; |
| 66 | |
| 67 | /*! |
| 68 | * for audio/video files, the duration of the file in seconds |
| 69 | */ |
| 70 | virtual uint duration() const = 0; |
| 71 | |
| 72 | /*! |
| 73 | * description of this enclosure for debugging purposes |
| 74 | */ |
| 75 | virtual QString debugInfo() const; |
| 76 | }; |
| 77 | |
| 78 | } // namespace Syndication |
| 79 | |
| 80 | #endif // SYNDICATION_ENCLOSURE_H |
| 81 | |