Syndication

link.h
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 * A link, pointing to webpages, media files on the web ("podcast"),
22 * related content, etc. See rel() for details.
23 *
24 * @author Frank Osterfeld
25 */
26class SYNDICATION_EXPORT Link : public Syndication::ElementWrapper
27{
28public:
29 /**
30 * creates a null link object.
31 */
32 Link();
33
34 /**
35 * creates a Link object wrapping an atom:link element.
36 * @param element a DOM element, should be a atom:link element
37 * (although not enforced), otherwise this object will not parse
38 * anything useful
39 */
40 explicit Link(const QDomElement &element);
41
42 /**
43 * URL of the referenced resource (required)
44 */
45 Q_REQUIRED_RESULT QString href() const;
46
47 /**
48 * the relation between the feed/entry and the linked resource.
49 *
50 * The value of rel() is usually one of the following:
51 *
52 * @c "alternate": The URL points to an alternate version of the
53 * feed/entry. In practice, this is the article described in an entry,
54 * or the homepage of the feed.
55 *
56 * @c "enclosure": The link describes an Enclosure. See
57 * Syndication::Enclosure for more information.
58 *
59 * @c "related": links to web resources with related content. E.g., an
60 * article discussing KDE might link to the KDE homepage.
61 *
62 * @c "self": "identifies a resource equivalent to the containing
63 * element". This is usually the URL of the feed source itself.
64 *
65 * @c "via": The link points to the source of the information contained
66 * in the feed/entry
67 *
68 * @return the rel value specified in the feed. Default value is
69 * @c "alternate"
70 */
71 Q_REQUIRED_RESULT QString rel() const;
72
73 /**
74 * MIME type of the linked resource. (optional)
75 *
76 * @return MIME type following (e.g., "text/html", "audio/mpeg"),
77 * or a null string if not set
78 */
79 Q_REQUIRED_RESULT QString type() const;
80
81 /**
82 * the language of the linked resource. (optional)
83 * If used together with a rel() value of "alternate", it
84 * implies a translated version of the entry.
85 *
86 * @return a language tag as defined in RFC 3066,
87 * or a null string if not specified
88 */
89 Q_REQUIRED_RESULT QString hrefLanguage() const;
90
91 /**
92 * human-readable information about the link. (optional)
93 *
94 * @return the link title as plain text ("<", "&" are text, not
95 * markup!), or a null string if not specified
96 */
97 Q_REQUIRED_RESULT QString title() const;
98
99 /**
100 * size of the linked resource in bytes. (optional)
101 *
102 * @return file size in bytes, or 0 if not specified
103 */
104 Q_REQUIRED_RESULT uint length() const;
105
106 /**
107 * description of the link object for debugging purposes
108 *
109 * @return debug string
110 */
111 Q_REQUIRED_RESULT QString debugInfo() const;
112};
113
114} // namespace Atom
115} // namespace Syndication
116
117#endif // SYNDICATION_ATOM_LINK_H
A wrapper for XML elements.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.