QFileSystemIterator: add constructor that takes QFileSystemEntry only
This is in preparation to adding constructors that take QDirListing::IteratorFlags, I would have had to add an init() private method to deduplicate the code, so instead add a constructor that can be delegated to. Task-number: QTBUG-125859 Change-Id: Idbc76fcba50f9d0016e4ddba03b2f532a33231bd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit c203c41109e41d03de8145a541ff5c8fbe976492) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
38f08eec14
commit
8b84c45762
@ -37,6 +37,7 @@ class QFileSystemIterator
|
||||
{
|
||||
public:
|
||||
QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters);
|
||||
QFileSystemIterator(const QFileSystemEntry &entry);
|
||||
~QFileSystemIterator();
|
||||
|
||||
bool advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData);
|
||||
|
@ -19,12 +19,10 @@ QT_BEGIN_NAMESPACE
|
||||
Native filesystem iterator, which uses ::opendir()/readdir()/dirent from the system
|
||||
libraries to iterate over the directory represented by \a entry.
|
||||
*/
|
||||
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters)
|
||||
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry)
|
||||
: dirPath(entry.filePath()),
|
||||
toUtf16(QStringDecoder::Utf8)
|
||||
{
|
||||
Q_UNUSED(filters);
|
||||
|
||||
dir.reset(QT_OPENDIR(entry.nativeFilePath().constData()));
|
||||
if (!dir) {
|
||||
lastError = errno;
|
||||
@ -34,6 +32,11 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
|
||||
}
|
||||
}
|
||||
|
||||
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters)
|
||||
: QFileSystemIterator(entry)
|
||||
{
|
||||
}
|
||||
|
||||
QFileSystemIterator::~QFileSystemIterator() = default;
|
||||
|
||||
bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData)
|
||||
|
@ -14,7 +14,7 @@ using namespace Qt::StringLiterals;
|
||||
|
||||
bool done = true;
|
||||
|
||||
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters)
|
||||
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry)
|
||||
: dirPath(entry.filePath())
|
||||
, nativePath(entry.nativeFilePath())
|
||||
, findFileHandle(INVALID_HANDLE_VALUE)
|
||||
@ -33,6 +33,11 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
|
||||
// In MSVC2015+ case we prepend //?/ for longer file-name support
|
||||
if (!dirPath.endsWith(u'/'))
|
||||
dirPath.append(u'/');
|
||||
}
|
||||
|
||||
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters)
|
||||
: QFileSystemIterator(entry)
|
||||
{
|
||||
if ((filters & (QDir::Dirs|QDir::Drives)) && (!(filters & (QDir::Files))))
|
||||
onlyDirs = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user