File indexing completed on 2024-12-01 03:45:45
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_ENCLOSURE_H 0009 #define SYNDICATION_ENCLOSURE_H 0010 0011 #include "syndication_export.h" 0012 0013 #include <QSharedPointer> 0014 #include <QString> 0015 0016 namespace Syndication 0017 { 0018 class Enclosure; 0019 //@cond PRIVATE 0020 typedef QSharedPointer<Enclosure> EnclosurePtr; 0021 //@endcond 0022 0023 /** 0024 * An enclosure describes a (media) file available on the net. 0025 * 0026 * Most of the time, enclosures are used for "podcasts", i.e. audio 0027 * files announced and distributed via syndication. 0028 * 0029 * @author Frank Osterfeld 0030 */ 0031 class SYNDICATION_EXPORT Enclosure 0032 { 0033 public: 0034 /** 0035 * destructor 0036 */ 0037 virtual ~Enclosure(); 0038 0039 /** 0040 * returns whether this enclosure is a null object. 0041 */ 0042 virtual bool isNull() const = 0; 0043 0044 /** 0045 * The URL of the linked resource (required). 0046 */ 0047 virtual QString url() const = 0; 0048 0049 /** 0050 * title of the enclosure. This is a human-readable description of the 0051 * linked file. If available, the title should be used in user interfaces 0052 * instead of the URL. If no title is set (e.g., RSS2 enclosures don't 0053 * have titles), use url() as fallback. 0054 * 0055 * @return title describing the enclosure, or a null string if not 0056 * specified. 0057 */ 0058 virtual QString title() const = 0; 0059 0060 /** 0061 * mimetype of the enclosure. 0062 * TODO: link mimetype specs 0063 * 0064 * Examples are @c "audio/mpeg" for MP3, or @c "application/pdf" for 0065 * PDF. 0066 * 0067 * @return the mimetype of the file, or a null string if not 0068 * specified 0069 */ 0070 virtual QString type() const = 0; 0071 0072 /** 0073 * returns the length of the linked file in bytes 0074 * 0075 * @return the length of the file in bytes, 0 if not specified 0076 */ 0077 virtual uint length() const = 0; 0078 0079 /** 0080 * for audio/video files, the duration of the file in seconds 0081 * 0082 * @return the duration of the file in seconds, or 0 if not specified 0083 */ 0084 virtual uint duration() const = 0; 0085 0086 /** 0087 * description of this enclosure for debugging purposes 0088 * 0089 * @return debug string 0090 */ 0091 virtual QString debugInfo() const; 0092 }; 0093 0094 } // namespace Syndication 0095 0096 #endif // SYNDICATION_ENCLOSURE_H