File indexing completed on 2024-12-08 12:27:13

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_IMAGE_H
0009 #define SYNDICATION_IMAGE_H
0010 
0011 #include <QSharedPointer>
0012 #include <QString>
0013 
0014 #include "syndication_export.h"
0015 
0016 namespace Syndication
0017 {
0018 class Image;
0019 //@cond PRIVATE
0020 typedef QSharedPointer<Image> ImagePtr;
0021 //@endcond
0022 
0023 /**
0024  * This class represents an image file on the web.
0025  * It is usually some kind of feed logo which can be displayed when showing the
0026  * feed description.
0027  *
0028  * @author Frank Osterfeld
0029  */
0030 class SYNDICATION_EXPORT Image
0031 {
0032 public:
0033     /**
0034      * destructor
0035      */
0036     virtual ~Image();
0037 
0038     /**
0039      * returns whether this image is a null object.
0040      */
0041     virtual bool isNull() const = 0;
0042 
0043     /**
0044      * the URL of a GIF, JPEG or PNG image
0045      */
0046     virtual QString url() const = 0;
0047 
0048     /**
0049      * Describes the image, can be used in the ALT attribute of the
0050      * HTML &lt;img> tag when the channel is rendered in HTML.
0051      *
0052      * @return TODO: specify format
0053      */
0054     virtual QString title() const = 0;
0055 
0056     /**
0057      * The URL of the site, when the channel is rendered, the image should
0058      * be a link to the site. If not set, use Feed::link().
0059      *
0060      * @return the url the rendered image should link to, or a null string
0061      * if not specified in the feed.
0062      */
0063     virtual QString link() const = 0;
0064 
0065     /**
0066      * optional text that can be included in the TITLE attribute of the link
0067      * formed around the image in HTML rendering.
0068      *
0069      * @return TODO: specify format (HTML etc.)
0070      */
0071     virtual QString description() const = 0;
0072 
0073     /**
0074      * The width of the image in pixels.
0075      *
0076      * @return image width in pixels or 0 if not specified in the feed.
0077      */
0078     virtual uint width() const = 0;
0079 
0080     /**
0081      * The height of the image in pixels
0082      *
0083      * @return image height in pixels or 0 of not specified in the feed.
0084      */
0085     virtual uint height() const = 0;
0086 
0087     /**
0088      * returns a description of the image for debugging purposes
0089      *
0090      * @return debug string
0091      */
0092     virtual QString debugInfo() const;
0093 };
0094 
0095 } // namespace Syndication
0096 
0097 #endif // SYNDICATION_IMAGE_H