1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef SYNDICATION_ATOM_LINK_H
9#define SYNDICATION_ATOM_LINK_H
10
11#include <syndication/elementwrapper.h>
12
13class QDomElement;
14class QString;
15
16namespace Syndication
17{
18namespace Atom
19{
20/*!
21 * \class Syndication::Atom::Link
22 * \inmodule Syndication
23 * \inheaderfile Syndication/Atom/Link
24 *
25 * \brief A link, pointing to webpages, media files on the web ("podcast"),
26 * related content, etc. See rel() for details.
27 */
28class SYNDICATION_EXPORT Link : public Syndication::ElementWrapper
29{
30public:
31 /*!
32 * creates a null link object.
33 */
34 Link();
35
36 /*!
37 * creates a Link object wrapping an atom:link element.
38 *
39 * \a element a DOM element, should be a atom:link element
40 * (although not enforced), otherwise this object will not parse
41 * anything useful
42 */
43 explicit Link(const QDomElement &element);
44
45 /*!
46 * URL of the referenced resource (required)
47 */
48 Q_REQUIRED_RESULT QString href() const;
49
50 /*!
51 * the relation between the feed/entry and the linked resource.
52 *
53 * The value of rel() is usually one of the following:
54 *
55 * \c "alternate": The URL points to an alternate version of the
56 * feed/entry. In practice, this is the article described in an entry,
57 * or the homepage of the feed.
58 *
59 * \c "enclosure": The link describes an Enclosure. See
60 * Syndication::Enclosure for more information.
61 *
62 * \c "related": links to web resources with related content. E.g., an
63 * article discussing KDE might link to the KDE homepage.
64 *
65 * \c "self": "identifies a resource equivalent to the containing
66 * element". This is usually the URL of the feed source itself.
67 *
68 * \c "via": The link points to the source of the information contained
69 * in the feed/entry
70 *
71 * Returns the rel value specified in the feed. Default value is
72 * \c "alternate"
73 */
74 Q_REQUIRED_RESULT QString rel() const;
75
76 /*!
77 * MIME type of the linked resource. (optional)
78 *
79 * Returns MIME type following (e.g., "text/html", "audio/mpeg"),
80 * or a null string if not set
81 */
82 Q_REQUIRED_RESULT QString type() const;
83
84 /*!
85 * the language of the linked resource. (optional)
86 * If used together with a rel() value of "alternate", it
87 * implies a translated version of the entry.
88 *
89 * Returns a language tag as defined in RFC 3066,
90 * or a null string if not specified
91 */
92 Q_REQUIRED_RESULT QString hrefLanguage() const;
93
94 /*!
95 * human-readable information about the link. (optional)
96 *
97 * Returns the link title as plain text ("<", "&" are text, not
98 * markup!), or a null string if not specified
99 */
100 Q_REQUIRED_RESULT QString title() const;
101
102 /*!
103 * size of the linked resource in bytes. (optional)
104 *
105 * Returns file size in bytes, or 0 if not specified
106 */
107 Q_REQUIRED_RESULT uint length() const;
108
109 /*!
110 * description of the link object for debugging purposes
111 *
112 * Returns debug string
113 */
114 Q_REQUIRED_RESULT QString debugInfo() const;
115};
116
117} // namespace Atom
118} // namespace Syndication
119
120#endif // SYNDICATION_ATOM_LINK_H
121

source code of syndication/src/atom/link.h