| 1 |
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#ifndef DCAPFSFILEENGINE_P_H |
| 6 |
#define DCAPFSFILEENGINE_P_H |
| 7 |
|
| 8 |
#include <DObject> |
| 9 |
|
| 10 |
#include <private/qfsfileengine_p.h> |
| 11 |
|
| 12 |
DCORE_BEGIN_NAMESPACE |
| 13 |
|
| 14 |
class DCapFSFileEngineHandler : public QAbstractFileEngineHandler |
| 15 |
{ |
| 16 |
public: |
| 17 |
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) |
| 18 |
std::unique_ptr<QAbstractFileEngine> create(const QString &fileName) const override; |
| 19 |
#else |
| 20 |
QAbstractFileEngine *create(const QString &fileName) const override; |
| 21 |
#endif |
| 22 |
}; |
| 23 |
|
| 24 |
class DCapFSFileEnginePrivate; |
| 25 |
class DCapFSFileEngine : public QFSFileEngine, public DObject |
| 26 |
{ |
| 27 |
D_DECLARE_PRIVATE(DCapFSFileEngine); |
| 28 |
public: |
| 29 |
DCapFSFileEngine(const QString &file); |
| 30 |
~DCapFSFileEngine() override; |
| 31 |
|
| 32 |
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) |
| 33 |
bool open(QIODevice::OpenMode openMode, std::optional<QFile::Permissions> permissions = std::nullopt) override; |
| 34 |
#else |
| 35 |
bool open(QIODevice::OpenMode openMode) override; |
| 36 |
#endif |
| 37 |
bool remove() override; |
| 38 |
bool copy(const QString &newName) override; |
| 39 |
bool rename(const QString &newName) override; |
| 40 |
bool renameOverwrite(const QString &newName) override; |
| 41 |
bool link(const QString &newName) override; |
| 42 |
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) |
| 43 |
bool mkdir(const QString &dirName, |
| 44 |
bool createParentDirectories, |
| 45 |
std::optional<QFile::Permissions> permissions = std::nullopt) const override; |
| 46 |
#else |
| 47 |
bool mkdir(const QString &dirName, bool createParentDirectories) const override; |
| 48 |
#endif |
| 49 |
bool rmdir(const QString &dirName, bool recurseParentDirectories) const override; |
| 50 |
FileFlags fileFlags(FileFlags type) const override; |
| 51 |
bool cloneTo(QAbstractFileEngine *target) override; |
| 52 |
bool setSize(qint64 size) override; |
| 53 |
QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override; |
| 54 |
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 1) |
| 55 |
IteratorUniquePtr beginEntryList(const QString &path, QDirListing::IteratorFlags filters, const QStringList &filterNames) override; |
| 56 |
#elif QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) |
| 57 |
IteratorUniquePtr beginEntryList(const QString &path, QDir::Filters filters, const QStringList &filterNames) override; |
| 58 |
#else |
| 59 |
Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override; |
| 60 |
#endif |
| 61 |
|
| 62 |
bool canReadWrite(const QString &path) const; |
| 63 |
}; |
| 64 |
|
| 65 |
DCORE_END_NAMESPACE |
| 66 |
#endif // DCAPFSFILEENGINE_P_H |