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 <QString>
12 #include <QDebug>
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 
31 Category::Category() : d(new Private)
32 {
33 }
34 
36  : d(other.d)
37 {
38 }
39 
41 {
42  d = other.d;
43  return *this;
44 }
45 
47 {
48 }
49 
50 void Category::setId(const QString &u)
51 {
52  d->m_id = u;
53 }
54 
56 {
57  return d->m_id;
58 }
59 
60 void Category::setName(const QString &name)
61 {
62  d->m_name = name;
63 }
64 
66 {
67  return d->m_name;
68 }
69 
71 {
72  d->m_displayName = name;
73 }
74 
76 {
77  return d->m_displayName;
78 }
79 
80 bool Category::isValid() const
81 {
82  return !(d->m_id.isEmpty());
83 }
void setName(const QString &name)
Sets the name of the Category.
Definition: category.cpp:60
QString name(const QVariant &location)
void setDisplayName(const QString &name)
Sets the display name of the Category.
Definition: category.cpp:70
Represents a single content category.
Definition: category.h:22
QDebug & nospace()
void setId(const QString &)
Sets the id of the Category.
Definition: category.cpp:50
Category & operator=(const Category &other)
Assignment operator.
Definition: category.cpp:40
Category()
Creates an empty Category.
Definition: category.cpp:31
QString displayName() const
Gets the display name of the Category.
Definition: category.cpp:75
QDebug & space()
QString name() const
Gets the name of the Category.
Definition: category.cpp:65
QString id() const
Gets the id of the Category.
Definition: category.cpp:55
~Category()
Destructor.
Definition: category.cpp:46
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
bool isValid() const
Checks whether this Category has an id.
Definition: category.cpp:80
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 22:59:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.