Attica

privatedata.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: Martin Sandsmark <[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 "privatedata.h"
10 
11 #include <QStringList>
12 
13 using namespace Attica;
14 
15 class PrivateData::Private : public QSharedData
16 {
17 public:
18  QMap<QString, QString> m_attributes;
19  QMap<QString, QDateTime> m_attributesTimestamp;
20 
21  Provider *m_provider;
22 
23  Private()
24  : m_provider(nullptr)
25  {
26  }
27 };
28 
29 PrivateData::PrivateData()
30  : d(new Private)
31 {
32 }
33 
34 PrivateData::PrivateData(const PrivateData &other)
35  : d(other.d)
36 {
37 }
38 
39 PrivateData &PrivateData::operator=(const Attica::PrivateData &other)
40 {
41  d = other.d;
42  return *this;
43 }
44 
45 PrivateData::~PrivateData()
46 {
47 }
48 
49 void PrivateData::setAttribute(const QString &key, const QString &value)
50 {
51  d->m_attributes[key] = value;
52  d->m_attributesTimestamp[key] = QDateTime::currentDateTime();
53 }
54 
55 QString PrivateData::attribute(const QString &key) const
56 {
57  return d->m_attributes[key];
58 }
59 
60 QDateTime PrivateData::timestamp(const QString &key) const
61 {
62  return d->m_attributesTimestamp[key];
63 }
64 
65 QStringList PrivateData::keys() const
66 {
67  return d->m_attributes.keys();
68 }
69 
70 void PrivateData::setTimestamp(const QString &key, const QDateTime &when)
71 {
72  d->m_attributesTimestamp[key] = when;
73 }
74 
QDateTime currentDateTime()
The Provider class represents one Open Collaboration Service provider.
Definition: provider.h:95
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:06:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.