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

syndication/rss2

  • sources
  • kde-4.14
  • kdepimlibs
  • 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 
27 namespace Syndication {
28 namespace RSS2 {
29 
30 
31 Enclosure::Enclosure() : ElementWrapper()
32 {
33 }
34 
35 Enclosure::Enclosure(const QDomElement& element) : ElementWrapper(element)
36 {
37 }
38 
39 QString Enclosure::url() const
40 {
41  return attribute(QLatin1String("url"));
42 }
43 
44 int 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 
57 QString Enclosure::type() const
58 {
59  return attribute(QLatin1String("type"));
60 }
61 
62 QString 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::Enclosure
Enclosure()
Default constructor, creates a null object, for which isNull() is true.
Definition: enclosure.cpp:31
QString::number
QString number(int n, int base)
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
QString
QLatin1String
Syndication::RSS2::Enclosure::debugInfo
QString debugInfo() const
Returns a description of the object for debugging purposes.
Definition: enclosure.cpp:62
QDomElement
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:41 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs 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

Search



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