• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

syndication/rss2

  • syndication
  • rss2
image.cpp
1/*
2 * This file is part of the syndication library
3 *
4 * Copyright (C) 2005 Frank Osterfeld <osterfeld@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#include "image.h"
24
25#include <QtCore/QString>
26
27namespace Syndication {
28namespace RSS2 {
29
30Image::Image() : ElementWrapper()
31{
32}
33
34Image::Image(const QDomElement& element) : ElementWrapper(element)
35{
36}
37
38QString Image::url() const
39{
40 return extractElementTextNS(QString(), QLatin1String("url"));
41}
42
43QString Image::title() const
44{
45 return extractElementTextNS(QString(), QLatin1String("title"));
46
47}
48
49QString Image::link() const
50{
51 return extractElementTextNS(QString(), QLatin1String("link"));
52
53}
54
55uint Image::width() const
56{
57 QString text;
58 bool ok;
59 uint c;
60
61 text = extractElementTextNS(QString(), QLatin1String("width"));
62 c = text.toUInt(&ok);
63 return ok ? c : 88; // set to default if not parsable
64}
65
66uint Image::height() const
67{
68 QString text;
69 bool ok;
70 uint c;
71
72 text = extractElementTextNS(QString(), QLatin1String("height"));
73 c = text.toUInt(&ok);
74 return ok ? c : 31; // set to default if not parsable
75}
76
77QString Image::description() const
78{
79 return extractElementTextNS(QString(), QLatin1String("description"));
80}
81
82QString Image::debugInfo() const
83{
84 QString info;
85 info += QLatin1String("### Image: ###################\n");
86 if (!title().isNull())
87 info += QLatin1String("title: #") + title() + QLatin1String("#\n");
88 if (!link().isNull())
89 info += QLatin1String("link: #") + link() + QLatin1String("#\n");
90 if (!description().isNull())
91 info += QLatin1String("description: #") + description() + QLatin1String("#\n");
92 if (!url().isNull())
93 info += QLatin1String("url: #") + url() + QLatin1String("#\n");
94 info += QLatin1String("width: #") + QString::number(width()) + QLatin1String("#\n");
95 info += QLatin1String("height: #") + QString::number(height()) + QLatin1String("#\n");
96 info += QLatin1String("### Image end ################\n");
97 return info;
98}
99
100} // namespace RSS2
101} //namespace Syndication
Syndication::RSS2::Image::description
QString description() const
optional text that can be included in the TITLE attribute of the link formed around the image in HTML...
Definition: image.cpp:77
Syndication::RSS2::Image::link
QString link() const
The URL of the site, when the channel is rendered, the image should be a link to the site.
Definition: image.cpp:49
Syndication::RSS2::Image::title
QString title() const
Describes the image, can be used in the ALT attribute of the HTML <img> tag when the channel is rende...
Definition: image.cpp:43
Syndication::RSS2::Image::debugInfo
QString debugInfo() const
Returns a description of the object for debugging purposes.
Definition: image.cpp:82
Syndication::RSS2::Image::width
uint width() const
The width of the image.
Definition: image.cpp:55
Syndication::RSS2::Image::Image
Image()
Default constructor, creates a null object, for which isNull() is true.
Definition: image.cpp:30
Syndication::RSS2::Image::url
QString url() const
the URL of a GIF, JPEG or PNG image
Definition: image.cpp:38
Syndication::RSS2::Image::height
uint height() const
The height of the image.
Definition: image.cpp:66
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

syndication/rss2

Skip menu "syndication/rss2"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal