Krita Source Code Documentation
Loading...
Searching...
No Matches
KoStore.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 1998, 1999 David Faure <faure@kde.org>
3 SPDX-FileCopyrightText: 2010 C. Boemann <cbo@boemann.dk>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef __koStore_h_
9#define __koStore_h_
10
11#include <QByteArray>
12#include <QIODevice>
13#include "kritastore_export.h"
14
15class QWidget;
16class QUrl;
17class KoStorePrivate;
18
25class KRITASTORE_EXPORT KoStore
26{
27public:
28
29 enum Mode { Read, Write };
30 enum Backend { Auto, Zip, Directory };
31
51 static KoStore *createStore(const QString &fileName, Mode mode,
52 const QByteArray &appIdentification = QByteArray(),
53 Backend backend = Auto, bool writeMimetype = true);
54
60 static KoStore *createStore(QIODevice *device, Mode mode,
61 const QByteArray &appIdentification = QByteArray(),
62 Backend backend = Auto, bool writeMimetype = true);
63
64
68 virtual ~KoStore();
69
76 bool open(const QString &name);
77
83 bool isOpen() const;
84
89 bool close();
90
96 QIODevice *device() const;
97
102 QByteArray read(qint64 max);
103
108 qint64 write(const QByteArray &data);
109
115 qint64 read(char *buffer, qint64 length);
116
121 virtual qint64 write(const char* data, qint64 length);
122
127 qint64 size() const;
128
132 bool bad() const;
133
137 Mode mode() const;
138
145 virtual QStringList directoryList() const;
146
156 virtual bool enterDirectory(const QString &directory);
157
163 bool leaveDirectory();
164
169 QString currentPath() const;
170
175 void pushDirectory();
176
181 void popDirectory();
182
187 bool hasFile(const QString &fileName) const;
188
192 bool hasDirectory(const QString &directoryName);
193
199 bool extractFile(const QString &sourceName, QByteArray &data);
200
202
203 bool seek(qint64 pos);
204 qint64 pos() const;
205 bool atEnd() const;
207
212 bool finalize();
213
218 virtual void setCompressionEnabled(bool e);
219
221 void setSubstitution(const QString &name, const QString &substitution);
222
223protected:
224 KoStore(Mode mode, bool writeMimetype = true);
225
230 virtual bool doFinalize() {
231 return true;
232 }
233
240 virtual bool openWrite(const QString &name) = 0;
248 virtual bool openRead(const QString &name) = 0;
249
253 virtual bool closeRead() = 0;
257 virtual bool closeWrite() = 0;
258
263 virtual bool enterRelativeDirectory(const QString &dirName) = 0;
264
269 virtual bool enterAbsoluteDirectory(const QString &path) = 0;
270
275 virtual bool fileExists(const QString &absPath) const = 0;
276
277protected:
279
280private:
281 Q_DECLARE_PRIVATE(KoStore)
282
283private:
284 KoStore(const KoStore& store);
285 KoStore& operator=(const KoStore& store);
286};
287
288#endif
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
KoStorePrivate * d_ptr
Definition KoStore.h:278
KoStore & operator=(const KoStore &store)
don't assign
virtual bool closeRead()=0
virtual bool openWrite(const QString &name)=0
virtual bool doFinalize()
Definition KoStore.h:230
virtual bool closeWrite()=0
virtual bool fileExists(const QString &absPath) const =0
virtual bool enterRelativeDirectory(const QString &dirName)=0
@ Auto
Definition KoStore.h:30
virtual bool openRead(const QString &name)=0
KoStore(const KoStore &store)
don't copy
virtual bool enterAbsoluteDirectory(const QString &path)=0