umbrello 26.03.70-1a62d36 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

compressionhelper.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 025 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#pragma once
7
8#include <QIODevice>
9#include <QString>
10#include <QFile>
11
12#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
13#include <KCompressionDevice>
14#else
15#include <KFilterDev>
16#endif
17
18 class CompressionHelper {
19 public:
24 static QIODevice* deviceForFile(const QString &fileName) {
25#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
26 KCompressionDevice *dev = new KCompressionDevice(fileName);
27 if (!dev->open(QIODevice::ReadOnly)) {
28 delete dev;
29 return nullptr;
30 }
31 return dev;
32#else
33 QIODevice *dev = new KFilterDev(fileName);
34 if (!dev || !dev->open(QIODevice::ReadOnly)) {
35 delete dev;
36 return nullptr;
37 }
38 return dev;
39#endif
40 }
41};
CompressionHelper
Definition: compressionhelper.h:18
CompressionHelper::deviceForFile
static QIODevice * deviceForFile(const QString &fileName)
Definition: compressionhelper.h:24