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

syndication/atom

  • sources
  • kde-4.14
  • kdepimlibs
  • syndication
  • atom
link.cpp
1 /*
2  * This file is part of the syndication library
3  *
4  * Copyright (C) 2006 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 "link.h"
24 #include "constants.h"
25 
26 #include <QtCore/QString>
27 
28 namespace Syndication {
29 namespace Atom {
30 
31 Link::Link() : ElementWrapper()
32 {
33 }
34 
35 Link::Link(const QDomElement& element) : ElementWrapper(element)
36 {
37 }
38 
39 QString Link::href() const
40 {
41  return completeURI(attribute(QLatin1String("href")));
42 }
43 
44 QString Link::rel() const
45 {
46  //"alternate" is default
47  return attribute(QLatin1String("rel"), QLatin1String("alternate"));
48 }
49 
50 QString Link::type() const
51 {
52  return attribute(QLatin1String("type"));
53 }
54 
55 QString Link::hrefLanguage() const
56 {
57  return attribute(QLatin1String("hreflang"));
58 }
59 
60 QString Link::title() const
61 {
62  return attribute(QLatin1String("title"));
63 }
64 
65 uint Link::length() const
66 {
67  QString lengthStr = attribute(QLatin1String("length"));
68 
69  bool ok;
70  uint c = lengthStr.toUInt(&ok);
71  return ok ? c : 0;
72 }
73 
74 QString Link::debugInfo() const
75 {
76  QString info;
77  info += QLatin1String("### Link: ###################\n");
78  if (!title().isEmpty())
79  info += QLatin1String("title: #") + title() + QLatin1String("#\n");
80  if (!href().isEmpty())
81  info += QLatin1String("href: #") + href() + QLatin1String("#\n");
82  if (!rel().isEmpty())
83  info += QLatin1String("rel: #") + rel() + QLatin1String("#\n");
84  if (!type().isEmpty())
85  info += QLatin1String("type: #") + type() + QLatin1String("#\n");
86  if (length() != 0)
87  info += QLatin1String("length: #") + QString::number(length()) + QLatin1String("#\n");
88  if (!hrefLanguage().isEmpty())
89  info += QLatin1String("hrefLanguage: #") + hrefLanguage() + QLatin1String("#\n");
90  info += QLatin1String("### Link end ################\n");
91  return info;
92 }
93 
94 } // namespace Atom
95 } //namespace Syndication
Syndication::Atom::Link::debugInfo
QString debugInfo() const
description of the link object for debugging purposes
Definition: link.cpp:74
Syndication::Atom::Link::length
uint length() const
size of the linked resource in bytes.
Definition: link.cpp:65
QString::number
QString number(int n, int base)
Syndication::Atom::Link::hrefLanguage
QString hrefLanguage() const
the language of the linked resource.
Definition: link.cpp:55
Syndication::Atom::Link::rel
QString rel() const
the relation between the feed/entry and the linked resource.
Definition: link.cpp:44
QString
Syndication::Atom::Link::Link
Link()
creates a null link object.
Definition: link.cpp:31
Syndication::Atom::Link::type
QString type() const
MIME type of the linked resource.
Definition: link.cpp:50
QLatin1String
QDomElement
Syndication::Atom::Link::href
QString href() const
URL of the referenced resource (required)
Definition: link.cpp:39
QString::toUInt
uint toUInt(bool *ok, int base) const
Syndication::Atom::Link::title
QString title() const
human-readable information about the link.
Definition: link.cpp:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

syndication/atom

Skip menu "syndication/atom"
  • 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