From 57cab7b9a8cb453625ffa01589a9e0d3cd8f07d3 Mon Sep 17 00:00:00 2001 From: Ievgenii Meshcheriakov Date: Mon, 1 Nov 2021 13:18:55 +0100 Subject: QAbstractFileEngine: Remove useless method overrides Remove useless overrides of QAbstractFileEngine methods from the derived classes. Also remove "This virtual function must be reimplemented by all subclasses" passages from the QAbstractFileEngine's documentation. There are pure virtual methods for such use cases. QAbstractFileEngine already contains useful defaults for classes not supporting all the functionality. Change-Id: Ia25965854f3809b15d7502da3749cc2f3414bbc3 Reviewed-by: Edward Welbourne --- src/corelib/io/qabstractfileengine.cpp | 34 ------------------ src/corelib/io/qresource.cpp | 65 ---------------------------------- src/corelib/io/qresource_p.h | 20 ----------- 3 files changed, 119 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp index 6b02ad6fd5..4cf3906a16 100644 --- a/src/corelib/io/qabstractfileengine.cpp +++ b/src/corelib/io/qabstractfileengine.cpp @@ -475,8 +475,6 @@ bool QAbstractFileEngine::isSequential() const Requests that the file is deleted from the file system. If the operation succeeds return true; otherwise return false. - This virtual function must be reimplemented by all subclasses. - \sa setFileName(), rmdir() */ bool QAbstractFileEngine::remove() @@ -499,8 +497,6 @@ bool QAbstractFileEngine::copy(const QString &newName) system. If the operation succeeds return true; otherwise return false. - This virtual function must be reimplemented by all subclasses. - \sa setFileName() */ bool QAbstractFileEngine::rename(const QString &newName) @@ -517,8 +513,6 @@ bool QAbstractFileEngine::rename(const QString &newName) If the operation succeeds, returns \c true; otherwise returns false. - This virtual function must be reimplemented by all subclasses. - \sa setFileName() */ bool QAbstractFileEngine::renameOverwrite(const QString &newName) @@ -547,8 +541,6 @@ bool QAbstractFileEngine::link(const QString &newName) succeed. If the operation succeeds return true; otherwise return false. - This virtual function must be reimplemented by all subclasses. - \sa setFileName(), rmdir(), isRelativePath() */ bool QAbstractFileEngine::mkdir(const QString &dirName, bool createParentDirectories) const @@ -567,8 +559,6 @@ bool QAbstractFileEngine::mkdir(const QString &dirName, bool createParentDirecto using this function if it is non-empty. If the operation succeeds return true; otherwise return false. - This virtual function must be reimplemented by all subclasses. - \sa setFileName(), remove(), mkdir(), isRelativePath() */ bool QAbstractFileEngine::rmdir(const QString &dirName, bool recurseParentDirectories) const @@ -584,8 +574,6 @@ bool QAbstractFileEngine::rmdir(const QString &dirName, bool recurseParentDirect simply truncated. If the operations succceeds return true; otherwise return false; - This virtual function must be reimplemented by all subclasses. - \sa size() */ bool QAbstractFileEngine::setSize(qint64 size) @@ -597,8 +585,6 @@ bool QAbstractFileEngine::setSize(qint64 size) /*! Should return true if the underlying file system is case-sensitive; otherwise return false. - - This virtual function must be reimplemented by all subclasses. */ bool QAbstractFileEngine::caseSensitive() const { @@ -609,8 +595,6 @@ bool QAbstractFileEngine::caseSensitive() const Return true if the file referred to by this file engine has a relative path; otherwise return false. - This virtual function must be reimplemented by all subclasses. - \sa setFileName() */ bool QAbstractFileEngine::isRelativePath() const @@ -627,8 +611,6 @@ bool QAbstractFileEngine::isRelativePath() const rather than a directory, or if the directory is unreadable or does not exist or if nothing matches the specifications. - This virtual function must be reimplemented by all subclasses. - \sa setFileName() */ QStringList QAbstractFileEngine::entryList(QDir::Filters filters, const QStringList &filterNames) const @@ -653,8 +635,6 @@ QStringList QAbstractFileEngine::entryList(QDir::Filters filters, const QStringL ignore any members not mentioned in \a type, thus avoiding some potentially expensive lookups or system calls. - This virtual function must be reimplemented by all subclasses. - \sa setFileName() */ QAbstractFileEngine::FileFlags QAbstractFileEngine::fileFlags(FileFlags type) const @@ -670,8 +650,6 @@ QAbstractFileEngine::FileFlags QAbstractFileEngine::fileFlags(FileFlags type) co honored. If the operations succceeds return true; otherwise return false; - This virtual function must be reimplemented by all subclasses. - \sa size() */ bool QAbstractFileEngine::setPermissions(uint perms) @@ -699,8 +677,6 @@ QByteArray QAbstractFileEngine::id() const file name set in setFileName() when an unhandled format is requested. - This virtual function must be reimplemented by all subclasses. - \sa setFileName(), FileName */ QString QAbstractFileEngine::fileName(FileName file) const @@ -714,8 +690,6 @@ QString QAbstractFileEngine::fileName(FileName file) const the file. If \a owner is \c OwnerGroup return the ID of the group that own the file. If you can't determine the owner return -2. - This virtual function must be reimplemented by all subclasses. - \sa owner(), setFileName(), FileOwner */ uint QAbstractFileEngine::ownerId(FileOwner owner) const @@ -730,8 +704,6 @@ uint QAbstractFileEngine::ownerId(FileOwner owner) const that own the file. If you can't determine the owner return QString(). - This virtual function must be reimplemented by all subclasses. - \sa ownerId(), setFileName(), FileOwner */ QString QAbstractFileEngine::owner(FileOwner owner) const @@ -747,8 +719,6 @@ QString QAbstractFileEngine::owner(FileOwner owner) const Sets the file \a time to \a newDate, returning true if successful; otherwise returns false. - This virtual function must be reimplemented by all subclasses. - \sa fileTime() */ bool QAbstractFileEngine::setFileTime(const QDateTime &newDate, FileTime time) @@ -766,8 +736,6 @@ bool QAbstractFileEngine::setFileTime(const QDateTime &newDate, FileTime time) most recently accessed (e.g. read or written). If the time cannot be determined return QDateTime() (an invalid date time). - This virtual function must be reimplemented by all subclasses. - \sa setFileName(), QDateTime, QDateTime::isValid(), FileTime */ QDateTime QAbstractFileEngine::fileTime(FileTime time) const @@ -780,8 +748,6 @@ QDateTime QAbstractFileEngine::fileTime(FileTime time) const Sets the file engine's file name to \a file. This file name is the file that the rest of the virtual functions will operate on. - This virtual function must be reimplemented by all subclasses. - \sa rename() */ void QAbstractFileEngine::setFileName(const QString &file) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 2b5d7232d6..8f0440ef2e 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1387,26 +1387,6 @@ protected: QResourceFileEnginePrivate() : offset(0) { } }; -bool QResourceFileEngine::mkdir(const QString &, bool) const -{ - return false; -} - -bool QResourceFileEngine::rmdir(const QString &, bool) const -{ - return false; -} - -bool QResourceFileEngine::setSize(qint64) -{ - return false; -} - -QStringList QResourceFileEngine::entryList(QDir::Filters filters, const QStringList &filterNames) const -{ - return QAbstractFileEngine::entryList(filters, filterNames); -} - bool QResourceFileEngine::caseSensitive() const { return true; @@ -1479,31 +1459,6 @@ qint64 QResourceFileEngine::read(char *data, qint64 len) return len; } -qint64 QResourceFileEngine::write(const char *, qint64) -{ - return -1; -} - -bool QResourceFileEngine::remove() -{ - return false; -} - -bool QResourceFileEngine::copy(const QString &) -{ - return false; -} - -bool QResourceFileEngine::rename(const QString &) -{ - return false; -} - -bool QResourceFileEngine::link(const QString &) -{ - return false; -} - qint64 QResourceFileEngine::size() const { Q_D(const QResourceFileEngine); @@ -1536,11 +1491,6 @@ bool QResourceFileEngine::seek(qint64 pos) return true; } -bool QResourceFileEngine::isSequential() const -{ - return false; -} - QAbstractFileEngine::FileFlags QResourceFileEngine::fileFlags(QAbstractFileEngine::FileFlags type) const { Q_D(const QResourceFileEngine); @@ -1565,11 +1515,6 @@ QAbstractFileEngine::FileFlags QResourceFileEngine::fileFlags(QAbstractFileEngin return ret; } -bool QResourceFileEngine::setPermissions(uint) -{ - return false; -} - QString QResourceFileEngine::fileName(FileName file) const { Q_D(const QResourceFileEngine); @@ -1600,22 +1545,12 @@ QString QResourceFileEngine::fileName(FileName file) const return d->resource.fileName(); } -bool QResourceFileEngine::isRelativePath() const -{ - return false; -} - uint QResourceFileEngine::ownerId(FileOwner) const { static const uint nobodyID = static_cast(-2); return nobodyID; } -QString QResourceFileEngine::owner(FileOwner) const -{ - return QString(); -} - QDateTime QResourceFileEngine::fileTime(FileTime time) const { Q_D(const QResourceFileEngine); diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h index fedf95bb33..31753b9a4f 100644 --- a/src/corelib/io/qresource_p.h +++ b/src/corelib/io/qresource_p.h @@ -74,34 +74,14 @@ public: virtual bool atEnd() const; bool seek(qint64) override; qint64 read(char *data, qint64 maxlen) override; - qint64 write(const char *data, qint64 len) override; - - bool remove() override; - bool copy(const QString &newName) override; - bool rename(const QString &newName) override; - bool link(const QString &newName) override; - - bool isSequential() const override; - - bool isRelativePath() const override; - - bool mkdir(const QString &dirName, bool createParentDirectories) const override; - bool rmdir(const QString &dirName, bool recurseParentDirectories) const override; - - bool setSize(qint64 size) override; - - QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override; bool caseSensitive() const override; FileFlags fileFlags(FileFlags type) const override; - bool setPermissions(uint perms) override; - QString fileName(QAbstractFileEngine::FileName file) const override; uint ownerId(FileOwner) const override; - QString owner(FileOwner) const override; QDateTime fileTime(FileTime time) const override; -- cgit v1.2.3