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

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef SYNDICATION_RSS2_ENCLOSURE_H
0009 #define SYNDICATION_RSS2_ENCLOSURE_H
0010 
0011 #include <syndication/elementwrapper.h>
0012 
0013 class QDomElement;
0014 class QString;
0015 
0016 namespace Syndication
0017 {
0018 namespace RSS2
0019 {
0020 /**
0021  * Describes a media object that is "attached" to the item.
0022  * The most common use case for enclosures are podcasts:
0023  * An audio file is attached to the feed and can be
0024  * automatically downloaded by a podcast client.
0025  *
0026  * @author Frank Osterfeld
0027  */
0028 class Enclosure : public ElementWrapper
0029 {
0030 public:
0031     /**
0032      * Default constructor, creates a null object, for which isNull() is
0033      * @c true.
0034      */
0035     Enclosure();
0036 
0037     /**
0038      * Creates an Enclosure object wrapping an @c &lt;enclosure> XML element.
0039      *
0040      * @param element The @c &lt;enclosure> element to wrap
0041      */
0042     explicit Enclosure(const QDomElement &element);
0043 
0044     /**
0045      * returns the URL of the enclosure
0046      */
0047     QString url() const;
0048 
0049     /**
0050      * returns the size of the enclosure in bytes
0051      */
0052     int length() const;
0053 
0054     /**
0055      * returns the mime type of the enclosure
0056      * (e.g. "audio/mpeg")
0057      */
0058     QString type() const;
0059 
0060     /**
0061      * Returns a description of the object for debugging purposes.
0062      *
0063      * @return debug string
0064      */
0065     QString debugInfo() const;
0066 };
0067 
0068 } // namespace RSS2
0069 } // namespace Syndication
0070 
0071 #endif // SYNDICATION_RSS2_ENCLOSURE_H