~ubuntu-branches/ubuntu/quantal/kdepimlibs/quantal-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * This file is part of the syndication library
 *
 * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#ifndef SYNDICATION_IMAGE_H
#define SYNDICATION_IMAGE_H

#include <QtCore/QString>
#include <boost/shared_ptr.hpp>

#include "ksyndication_export.h"

namespace Syndication {

class Image;
//@cond PRIVATE
typedef boost::shared_ptr<Image> ImagePtr;
//@endcond

/**
 * This class represents an image file on the web.
 * It is usually some kind of feed logo which can be displayed when showing the
 * feed description.
 *
 * @author Frank Osterfeld
 */
class SYNDICATION_EXPORT Image
{
    public:

        /**
         * destructor
         */
        virtual ~Image();

        /**
         * returns whether this image is a null object.
         */
        virtual bool isNull() const = 0;

        /**
         * the URL of a GIF, JPEG or PNG image
         */
        virtual QString url() const = 0;

        /**
         * Describes the image, can be used in the ALT attribute of the
         * HTML &lt;img> tag when the channel is rendered in HTML.
         *
         * @return TODO: specify format
         */
        virtual QString title() const = 0;


        /**
         * The URL of the site, when the channel is rendered, the image should
         * be a link to the site. If not set, use Feed::link().
         *
         * @return the url the rendered image should link to, or a null string
         * if not specified in the feed.
         */
        virtual QString link() const = 0;

        /**
         * optional text that can be included in the TITLE attribute of the link
         * formed around the image in HTML rendering.
         *
         * @return TODO: specify format (HTML etc.)
         */
        virtual QString description() const = 0;

        /**
         * The width of the image in pixels.
         *
         * @return image width in pixels or 0 if not specified in the feed.
         */
        virtual uint width() const = 0;

        /**
         * The height of the image in pixels
         *
         * @return image height in pixels or 0 of not specified in the feed.
         */
        virtual uint height() const = 0;

        /**
         * returns a description of the image for debugging purposes
         *
         * @return debug string
         */
        virtual QString debugInfo() const;
};

} // namespace Syndication

#endif // SYNDICATION_IMAGE_H