Krita Source Code Documentation
Loading...
Searching...
No Matches
KoResourceBundleManifest.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2014 Victor Lafon <metabolic.ewilan@hotmail.fr>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef KORESOURCEBUNDLEMANIFEST_H
8#define KORESOURCEBUNDLEMANIFEST_H
9
10#include <QString>
11#include <QMap>
12#include <QMultiMap>
13#include <QDomElement>
14
15#include <kritaresources_export.h>
16
17class QIODevice;
18
19class KRITARESOURCES_EXPORT KoResourceBundleManifest
20{
21public:
22
24
26
27 ResourceReference(const QString &_resourcePath, const QList<QString> &_tagList, const QString &_fileTypeName,
28 const QString &_md5, const int _resourceId = -1, const QString _filenameInBundle = "") {
29 resourcePath = _resourcePath;
30 tagList = _tagList;
31 fileTypeName = _fileTypeName;
32 md5sum = _md5;
33 resourceId = _resourceId;
34 // only necessary to provide if filename in bundle is different from the filename on disk
35 // for example for versioned resources
36 filenameInBundle = _filenameInBundle.isEmpty() ? resourcePath : _filenameInBundle;
37 }
38
39 QString resourcePath;
41 QString fileTypeName;
42 QString md5sum;
45 };
46
52
57
58
62 bool load(QIODevice *device);
63
67 bool save(QIODevice *device);
68
76 void addResource(const QString &fileType, const QString &fileName, const QStringList &tagFileList, const QString &md5, const int resourceId = -1, const QString filenameInBundle = "");
77 void removeResource(ResourceReference &resource);
78
79 QStringList types() const;
80
81 QStringList tags() const;
82
83 QList<ResourceReference> files(const QString &type = QString()) const;
84
90 void removeFile(QString fileName);
91
92private:
93 QMap<QString, QMap<QString, ResourceReference>> m_resources;
94 bool parseFileEntry(const QDomElement &e);
95};
96
97
98#endif
QMap< QString, QMap< QString, ResourceReference > > m_resources
ResourceReference(const QString &_resourcePath, const QList< QString > &_tagList, const QString &_fileTypeName, const QString &_md5, const int _resourceId=-1, const QString _filenameInBundle="")