Syndication

atom/category.cpp
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "category.h"
9 #include "constants.h"
10 
11 #include <QDomElement>
12 #include <QString>
13 
14 namespace Syndication
15 {
16 namespace Atom
17 {
19  : ElementWrapper()
20 {
21 }
22 
24  : ElementWrapper(element)
25 {
26 }
27 
29 {
30  return attribute(QStringLiteral("term"));
31 }
32 
34 {
35  // NOTE: The scheme IRI is not completed by purpose.
36  // According to Atom spec, it must be an absolute IRI.
37  // If this is a problem with real-world feeds, it might be changed.
38  return attribute(QStringLiteral("scheme"));
39 }
40 
42 {
43  return attribute(QStringLiteral("label"));
44 }
45 
47 {
48  QString info = QLatin1String("### Category: ###################\n");
49  info += QLatin1String("term: #") + term() + QLatin1String("#\n");
50  if (!scheme().isEmpty()) {
51  info += QLatin1String("scheme: #") + scheme() + QLatin1String("#\n");
52  }
53  if (!label().isEmpty()) {
54  info += QLatin1String("label: #") + label() + QLatin1String("#\n");
55  }
56  info += QLatin1String("### Category end ################\n");
57 
58  return info;
59 }
60 
61 } // namespace Atom
62 } // namespace Syndication
QString attribute(const QString &name, const QString &defValue=QString()) const
Returns the attribute called name.
QString scheme() const
naming scheme the category term is part of.
A wrapper for XML elements.
QString label() const
Label of the category (optional).
QString debugInfo() const
description of this category object for debugging purposes
QString term() const
a term describing the category.
Category()
creates a null category object.
const QDomElement & element() const
returns the wrapped resource.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Sep 27 2021 23:04:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.