File indexing completed on 2024-05-12 15:59:48
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Boudewijn Rempt <boud@valdyas.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISMEMORYSTORAGE_H 0008 #define KISMEMORYSTORAGE_H 0009 0010 #include <KisStoragePlugin.h> 0011 0012 #include <kritaresources_export.h> 0013 0014 /** 0015 * @brief The KisMemoryStorage class stores the temporary resources 0016 * that are not saved to disk or bundle. It is also used to stores 0017 * transient per-document resources, such as the document-local palette 0018 * list. 0019 */ 0020 class KRITARESOURCES_EXPORT KisMemoryStorage : public KisStoragePlugin 0021 { 0022 public: 0023 KisMemoryStorage(const QString &location = QString("memory")); 0024 virtual ~KisMemoryStorage(); 0025 0026 /// Copying the memory storage clones all contained resources and tags 0027 KisMemoryStorage(const KisMemoryStorage &rhs); 0028 0029 /// This clones all contained resources and tags from rhs 0030 KisMemoryStorage &operator=(const KisMemoryStorage &rhs); 0031 0032 bool saveAsNewVersion(const QString &resourceType, KoResourceSP resource) override; 0033 0034 KisResourceStorage::ResourceItem resourceItem(const QString &url) override; 0035 bool loadVersionedResource(KoResourceSP resource) override; 0036 bool importResource(const QString &url, QIODevice *device) override; 0037 bool exportResource(const QString &url, QIODevice *device) override; 0038 bool addResource(const QString &resourceType, KoResourceSP resource) override; 0039 0040 QString resourceMd5(const QString &url) override; 0041 QSharedPointer<KisResourceStorage::ResourceIterator> resources(const QString &resourceType) override; 0042 QSharedPointer<KisResourceStorage::TagIterator> tags(const QString &resourceType) override; 0043 0044 void setMetaData(const QString &key, const QVariant &value) override; 0045 QStringList metaDataKeys() const override; 0046 QVariant metaData(const QString &key) const override; 0047 0048 private: 0049 class Private; 0050 QScopedPointer<Private> d; 0051 0052 }; 0053 0054 0055 #endif // KISMEMORYSTORAGE_H