1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2000-2005 David Faure <faure@kde.org>
3 SPDX-FileCopyrightText: 2003 Leo Savernik <l.savernik@aon.at>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KARCHIVE_P_H
9#define KARCHIVE_P_H
10
11#include "karchive.h"
12
13#include <QSaveFile>
14
15class KArchivePrivate
16{
17 Q_DECLARE_TR_FUNCTIONS(KArchivePrivate)
18
19public:
20 KArchivePrivate(KArchive *parent)
21 : q(parent)
22 {
23 }
24 ~KArchivePrivate()
25 {
26 if (deviceOwned) {
27 delete dev; // we created it ourselves in open()
28 dev = nullptr;
29 }
30
31 delete saveFile;
32 delete rootDir;
33 }
34
35 KArchivePrivate(const KArchivePrivate &) = delete;
36 KArchivePrivate &operator=(const KArchivePrivate &) = delete;
37
38 static bool hasRootDir(KArchive *archive)
39 {
40 return archive->d->rootDir;
41 }
42
43 void abortWriting();
44
45 static QDateTime time_tToDateTime(uint time_t);
46
47 KArchiveDirectory *findOrCreate(const QString &path, int recursionCounter);
48
49 KArchive *q = nullptr;
50 KArchiveDirectory *rootDir = nullptr;
51 QSaveFile *saveFile = nullptr;
52 QIODevice *dev = nullptr;
53 QString fileName;
54 QIODevice::OpenMode mode = QIODevice::NotOpen;
55 bool deviceOwned = false; // if true, we (KArchive) own dev and must delete it
56 QString errorStr{tr(sourceText: "Unknown error")};
57};
58
59#endif // KARCHIVE_P_H
60

source code of karchive/src/karchive_p.h