Attica

privatedata.cpp
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: Martin Sandsmark <martin.sandsmark@kde.org>
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
13using namespace Attica;
14
15class Q_DECL_HIDDEN PrivateData::Private : public QSharedData
16{
17public:
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
29PrivateData::PrivateData()
30 : d(new Private)
31{
32}
33
34PrivateData::PrivateData(const PrivateData &other)
35 : d(other.d)
36{
37}
38
39PrivateData &PrivateData::operator=(const Attica::PrivateData &other)
40{
41 d = other.d;
42 return *this;
43}
44
45PrivateData::~PrivateData()
46{
47}
48
49void PrivateData::setAttribute(const QString &key, const QString &value)
50{
51 d->m_attributes[key] = value;
52 d->m_attributesTimestamp[key] = QDateTime::currentDateTime();
53}
54
56{
57 return d->m_attributes[key];
58}
59
61{
62 return d->m_attributesTimestamp[key];
63}
64
66{
67 return d->m_attributes.keys();
68}
69
70void PrivateData::setTimestamp(const QString &key, const QDateTime &when)
71{
72 d->m_attributesTimestamp[key] = when;
73}
Represents private data.
Definition privatedata.h:30
void setTimestamp(const QString &key, const QDateTime &when)
Sets when an attribute last was changed (mostly for internal use).
QStringList keys() const
Returns a list of fetched keys.
QString attribute(const QString &key) const
Returns an attribute referenced by \key.
void setAttribute(const QString &key, const QString &value)
Sets an attribute referenced by \key to \value.
QDateTime timestamp(const QString &key) const
Returns the date and time an attribute last was changed.
The Provider class represents one Open Collaboration Service provider.
Definition provider.h:97
The Attica namespace,.
QDateTime currentDateTime()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:54:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.