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_CATEGORY_H |
9 | #define SYNDICATION_ATOM_CATEGORY_H |
10 | |
11 | #include <syndication/elementwrapper.h> |
12 | |
13 | class QDomElement; |
14 | class QString; |
15 | |
16 | namespace Syndication |
17 | { |
18 | namespace Atom |
19 | { |
20 | /*! |
21 | * \class Syndication::Atom::Category |
22 | * \inmodule Syndication |
23 | * \inheaderfile Syndication/Atom/Category |
24 | * |
25 | * \brief A category for categorizing items or whole feeds. |
26 | * |
27 | * A category can be an informal string set by the feed author ("General", |
28 | * "Stuff I like"), a tag assigned by readers, as known from flickr.com |
29 | * or de.licio.us ("KDE", "funny"), or a term from a formally defined ontology. |
30 | * |
31 | * To represent the category in a user interface, use label() (or term() as |
32 | * fallback). To create a key for e.g. storage purposes, use scheme() + term(). |
33 | */ |
34 | class SYNDICATION_EXPORT Category : public ElementWrapper |
35 | { |
36 | public: |
37 | /*! |
38 | * creates a null category object. |
39 | */ |
40 | Category(); |
41 | |
42 | /*! |
43 | * creates a Category object wrapping an atom:category element. |
44 | * |
45 | * \a element a DOM element, should be a atom:category element |
46 | * (although not enforced), otherwise this object will not parse |
47 | * anything useful |
48 | */ |
49 | explicit Category(const QDomElement &element); |
50 | |
51 | /*! |
52 | * a term describing the category. (required) |
53 | * |
54 | * Returns the category term as plain text (no HTML, "&", "<" etc. are |
55 | * unescaped!) |
56 | */ |
57 | Q_REQUIRED_RESULT QString term() const; |
58 | |
59 | /*! |
60 | * naming scheme the category term is part of. (optional) |
61 | * |
62 | * A term is unique in its scheme (like in C++ identifiers are |
63 | * unique in their namespaces) |
64 | * |
65 | * Returns a URI representing the scheme, or a null string |
66 | * if not specified |
67 | */ |
68 | Q_REQUIRED_RESULT QString scheme() const; |
69 | |
70 | /*! |
71 | * Label of the category (optional). |
72 | * |
73 | * If specified, this string should be used to represent this category |
74 | * in a user interface. |
75 | * |
76 | * If not specified, use term() instead. |
77 | * |
78 | * Returns the label as plain text (no HTML, "&", "<" etc. are |
79 | * unescaped!), or a null string if not specified |
80 | */ |
81 | Q_REQUIRED_RESULT QString label() const; |
82 | |
83 | /*! |
84 | * description of this category object for debugging purposes |
85 | */ |
86 | Q_REQUIRED_RESULT QString debugInfo() const; |
87 | }; |
88 | |
89 | } // namespace Atom |
90 | } // namespace Syndication |
91 | |
92 | #endif // SYNDICATION_ATOM_CATEGORY_H |
93 | |