summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qabstractfileengine_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qabstractfileengine_p.h')
-rw-r--r--src/corelib/io/qabstractfileengine_p.h86
1 files changed, 25 insertions, 61 deletions
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h
index 9649e67029..949f89c1f2 100644
--- a/src/corelib/io/qabstractfileengine_p.h
+++ b/src/corelib/io/qabstractfileengine_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 QABSTRACTFILEENGINE_P_H
#define QABSTRACTFILEENGINE_P_H
@@ -55,6 +19,7 @@
#include "QtCore/qfile.h"
#include "QtCore/qdir.h"
+#include <memory>
#include <optional>
#ifdef open
@@ -109,18 +74,14 @@ public:
CanonicalPathName,
BundleName,
JunctionName,
+ RawLinkPath,
NFileNames // Must be last.
};
enum FileOwner {
OwnerUser,
OwnerGroup
};
- enum FileTime {
- AccessTime,
- BirthTime,
- MetadataChangeTime,
- ModificationTime
- };
+
virtual ~QAbstractFileEngine();
@@ -151,8 +112,8 @@ public:
virtual QString fileName(FileName file=DefaultName) const;
virtual uint ownerId(FileOwner) const;
virtual QString owner(FileOwner) const;
- virtual bool setFileTime(const QDateTime &newDate, FileTime time);
- virtual QDateTime fileTime(FileTime time) const;
+ virtual bool setFileTime(const QDateTime &newDate, QFile::FileTime time);
+ virtual QDateTime fileTime(QFile::FileTime time) const;
virtual void setFileName(const QString &file);
virtual int handle() const;
virtual bool cloneTo(QAbstractFileEngine *target);
@@ -161,8 +122,11 @@ public:
bool unmap(uchar *ptr);
typedef QAbstractFileEngineIterator Iterator;
- virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames);
- virtual Iterator *endEntryList();
+ using IteratorUniquePtr = std::unique_ptr<Iterator>;
+
+ virtual IteratorUniquePtr
+ beginEntryList(const QString &path, QDir::Filters filters, const QStringList &filterNames);
+ virtual IteratorUniquePtr endEntryList() { return {}; }
virtual qint64 read(char *data, qint64 maxlen);
virtual qint64 readLine(char *data, qint64 maxlen);
@@ -202,7 +166,7 @@ public:
virtual bool supportsExtension(Extension extension) const;
// Factory
- static QAbstractFileEngine *create(const QString &fileName);
+ static std::unique_ptr<QAbstractFileEngine> create(const QString &fileName);
protected:
void setError(QFile::FileError error, const QString &str);
@@ -223,18 +187,17 @@ class Q_CORE_EXPORT QAbstractFileEngineHandler
public:
QAbstractFileEngineHandler();
virtual ~QAbstractFileEngineHandler();
- virtual QAbstractFileEngine *create(const QString &fileName) const = 0;
+ virtual std::unique_ptr<QAbstractFileEngine> create(const QString &fileName) const = 0;
};
-class QAbstractFileEngineIteratorPrivate;
class Q_CORE_EXPORT QAbstractFileEngineIterator
{
public:
- QAbstractFileEngineIterator(QDir::Filters filters, const QStringList &nameFilters);
+ QAbstractFileEngineIterator(const QString &path, QDir::Filters filters,
+ const QStringList &nameFilters);
virtual ~QAbstractFileEngineIterator();
- virtual QString next() = 0;
- virtual bool hasNext() const = 0;
+ virtual bool advance() = 0;
QString path() const;
QStringList nameFilters() const;
@@ -242,19 +205,20 @@ public:
virtual QString currentFileName() const = 0;
virtual QFileInfo currentFileInfo() const;
- QString currentFilePath() const;
+ virtual QString currentFilePath() const;
protected:
- enum EntryInfoType {
- };
- virtual QVariant entryInfo(EntryInfoType type) const;
+ mutable QFileInfo m_fileInfo;
private:
Q_DISABLE_COPY_MOVE(QAbstractFileEngineIterator)
friend class QDirIterator;
friend class QDirIteratorPrivate;
- void setPath(const QString &path);
- QScopedPointer<QAbstractFileEngineIteratorPrivate> d;
+ friend class QDirListingPrivate;
+
+ QDir::Filters m_filters;
+ QStringList m_nameFilters;
+ QString m_path;
};
class QAbstractFileEnginePrivate
@@ -273,7 +237,7 @@ public:
Q_DECLARE_PUBLIC(QAbstractFileEngine)
};
-QAbstractFileEngine *qt_custom_file_engine_handler_create(const QString &path);
+std::unique_ptr<QAbstractFileEngine> qt_custom_file_engine_handler_create(const QString &path);
QT_END_NAMESPACE