File indexing completed on 2024-03-24 15:23:51

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2010 Martin Sandsmark <martin.sandsmark@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 #ifndef ATTICA_PRIVATEDATA_H
0009 #define ATTICA_PRIVATEDATA_H
0010 
0011 #include "provider.h"
0012 
0013 #include <QDateTime>
0014 #include <QList>
0015 #include <QMap>
0016 #include <QSharedDataPointer>
0017 #include <QUrl>
0018 
0019 #include "attica_export.h"
0020 
0021 namespace Attica
0022 {
0023 
0024 /**
0025  * @class PrivateData privatedata.h <Attica/PrivateData>
0026  *
0027  * Represents private data.
0028  */
0029 class ATTICA_EXPORT PrivateData
0030 {
0031 public:
0032     class Parser;
0033 
0034     typedef QList<PrivateData> List; // nonsense
0035 
0036     PrivateData();
0037     PrivateData(const PrivateData &other);
0038     PrivateData &operator=(const PrivateData &other);
0039     ~PrivateData();
0040 
0041     /**
0042      * Sets an attribute referenced by \key to \value.
0043      */
0044     void setAttribute(const QString &key, const QString &value);
0045 
0046     /**
0047      * Returns an attribute referenced by \key.
0048      */
0049     QString attribute(const QString &key) const;
0050 
0051     /**
0052      * Sets when an attribute last was changed (mostly for internal use).
0053      */
0054     void setTimestamp(const QString &key, const QDateTime &when);
0055 
0056     /**
0057      * Returns the date and time an attribute last was changed.
0058      */
0059     QDateTime timestamp(const QString &key) const;
0060 
0061     /**
0062      * Returns a list of fetched keys.
0063      */
0064     QStringList keys() const;
0065 
0066 private:
0067     class Private;
0068     QSharedDataPointer<Private> d;
0069 };
0070 
0071 }
0072 
0073 #endif // ATTICA_ATTRIBUTES_H