summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qfsfileengine_p.h')
-rw-r--r--src/corelib/io/qfsfileengine_p.h74
1 files changed, 28 insertions, 46 deletions
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index d6e7ecb592..f70507147a 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFSFILEENGINE_P_H
#define QFSFILEENGINE_P_H
@@ -57,6 +21,12 @@
#include <QtCore/private/qfilesystemmetadata_p.h>
#include <qhash.h>
+#include <optional>
+
+#ifdef Q_OS_UNIX
+#include <sys/types.h> // for mode_t
+#endif
+
#ifndef QT_NO_FSFILEENGINE
QT_BEGIN_NAMESPACE
@@ -79,7 +49,7 @@ public:
explicit QFSFileEngine(const QString &file);
~QFSFileEngine();
- bool open(QIODevice::OpenMode openMode) override;
+ bool open(QIODevice::OpenMode openMode, std::optional<QFile::Permissions> permissions) override;
bool open(QIODevice::OpenMode flags, FILE *fh);
bool close() override;
bool flush() override;
@@ -93,7 +63,8 @@ public:
bool rename(const QString &newName) override;
bool renameOverwrite(const QString &newName) override;
bool link(const QString &newName) override;
- bool mkdir(const QString &dirName, bool createParentDirectories) const override;
+ bool mkdir(const QString &dirName, bool createParentDirectories,
+ std::optional<QFile::Permissions> permissions) const override;
bool rmdir(const QString &dirName, bool recurseParentDirectories) const override;
bool setSize(qint64 size) override;
bool caseSensitive() const override;
@@ -105,14 +76,14 @@ public:
QString fileName(FileName file) const override;
uint ownerId(FileOwner) const override;
QString owner(FileOwner) const override;
- bool setFileTime(const QDateTime &newDate, FileTime time) override;
- QDateTime fileTime(FileTime time) const override;
+ bool setFileTime(const QDateTime &newDate, QFile::FileTime time) override;
+ QDateTime fileTime(QFile::FileTime time) const override;
void setFileName(const QString &file) override;
int handle() const override;
#ifndef QT_NO_FILESYSTEMITERATOR
- Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
- Iterator *endEntryList() override;
+ IteratorUniquePtr beginEntryList(const QString &path, QDir::Filters filters,
+ const QStringList &filterNames) override;
#endif
qint64 read(char *data, qint64 maxlen) override;
@@ -153,7 +124,7 @@ public:
QFileSystemEntry fileEntry;
QIODevice::OpenMode openMode;
- bool nativeOpen(QIODevice::OpenMode openMode);
+ bool nativeOpen(QIODevice::OpenMode openMode, std::optional<QFile::Permissions> permissions);
bool openFh(QIODevice::OpenMode flags, FILE *fh);
bool openFd(QIODevice::OpenMode flags, int fd);
bool nativeClose();
@@ -180,6 +151,9 @@ public:
#ifndef Q_OS_WIN
bool isSequentialFdFh() const;
#endif
+#ifdef Q_OS_WIN
+ bool nativeRenameOverwrite(const QString &newName);
+#endif
uchar *map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags);
bool unmap(uchar *ptr);
@@ -197,7 +171,11 @@ public:
mutable int cachedFd;
mutable DWORD fileAttrib;
#else
- QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps;
+ struct StartAndLength {
+ int start; // offset % PageSize
+ size_t length; // length + offset % PageSize
+ };
+ QHash<uchar *, StartAndLength> maps;
#endif
int fd;
@@ -239,6 +217,10 @@ protected:
void init();
QAbstractFileEngine::FileFlags getPermissions(QAbstractFileEngine::FileFlags type) const;
+
+#ifdef Q_OS_UNIX
+ bool nativeOpenImpl(QIODevice::OpenMode openMode, mode_t mode);
+#endif
};
QT_END_NAMESPACE