Attica

category.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2008 Cornelius Schumacher <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #include "category.h"
10 
11 #include <QDebug>
12 #include <QString>
13 
14 using namespace Attica;
15 
17 {
18  const QString name = cat.isValid() ? cat.name() : QStringLiteral("Invalid");
19  s.nospace() << "Category(" << name << ')';
20  return s.space();
21 }
22 
23 class Category::Private : public QSharedData
24 {
25 public:
26  QString m_id;
27  QString m_name;
28  QString m_displayName;
29 };
30 
32  : d(new Private)
33 {
34 }
35 
37  : d(other.d)
38 {
39 }
40 
42 {
43  d = other.d;
44  return *this;
45 }
46 
48 {
49 }
50 
51 void Category::setId(const QString &u)
52 {
53  d->m_id = u;
54 }
55 
57 {
58  return d->m_id;
59 }
60 
61 void Category::setName(const QString &name)
62 {
63  d->m_name = name;
64 }
65 
67 {
68  return d->m_name;
69 }
70 
72 {
73  d->m_displayName = name;
74 }
75 
77 {
78  return d->m_displayName;
79 }
80 
81 bool Category::isValid() const
82 {
83  return !(d->m_id.isEmpty());
84 }
void setName(const QString &name)
Sets the name of the Category.
Definition: category.cpp:61
QString name(const QVariant &location)
void setDisplayName(const QString &name)
Sets the display name of the Category.
Definition: category.cpp:71
Represents a single content category.
Definition: category.h:21
QDebug & nospace()
void setId(const QString &)
Sets the id of the Category.
Definition: category.cpp:51
Category & operator=(const Category &other)
Assignment operator.
Definition: category.cpp:41
Category()
Creates an empty Category.
Definition: category.cpp:31
QString displayName() const
Gets the display name of the Category.
Definition: category.cpp:76
QDebug & space()
QString name() const
Gets the name of the Category.
Definition: category.cpp:66
QString id() const
Gets the id of the Category.
Definition: category.cpp:56
~Category()
Destructor.
Definition: category.cpp:47
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
bool isValid() const
Checks whether this Category has an id.
Definition: category.cpp:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu May 13 2021 23:00:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.