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

syndication/rss2

  • syndication
  • rss2
enclosure.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 "enclosure.h"
24
25
26
27namespace Syndication {
28namespace RSS2 {
29
30
31Enclosure::Enclosure() : ElementWrapper()
32{
33}
34
35Enclosure::Enclosure(const QDomElement& element) : ElementWrapper(element)
36{
37}
38
39QString Enclosure::url() const
40{
41 return attribute(QLatin1String("url"));
42}
43
44int Enclosure::length() const
45{
46 int length = 0;
47
48 if (hasAttribute(QLatin1String("length")))
49 {
50 bool ok;
51 int c = attribute(QLatin1String("length")).toInt(&ok);
52 length = ok ? c : 0;
53 }
54 return length;
55}
56
57QString Enclosure::type() const
58{
59 return attribute(QLatin1String("type"));
60}
61
62QString Enclosure::debugInfo() const
63{
64 QString info;
65 info += QLatin1String("### Enclosure: ###################\n");
66 if (!url().isNull())
67 info += QLatin1String("url: #") + url() + QLatin1String("#\n");
68 if (!type().isNull())
69 info += QLatin1String("type: #") + type() + QLatin1String("#\n");
70 if (length() != -1)
71 info += QLatin1String("length: #") + QString::number(length()) + QLatin1String("#\n");
72 info += QLatin1String("### Enclosure end ################\n");
73 return info;
74}
75
76} // namespace RSS2
77} // namespace Syndication
Syndication::RSS2::Enclosure::length
int length() const
returns the size of the enclosure in bytes
Definition: enclosure.cpp:44
Syndication::RSS2::Enclosure::url
QString url() const
returns the URL of the enclosure
Definition: enclosure.cpp:39
Syndication::RSS2::Enclosure::type
QString type() const
returns the mime type of the enclosure (e.g.
Definition: enclosure.cpp:57
Syndication::RSS2::Enclosure::Enclosure
Enclosure()
Default constructor, creates a null object, for which isNull() is true.
Definition: enclosure.cpp:31
Syndication::RSS2::Enclosure::debugInfo
QString debugInfo() const
Returns a description of the object for debugging purposes.
Definition: enclosure.cpp:62
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