summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/optional
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-12-17 21:10:18 +0200
committerAhmad Samir <a.samirh78@gmail.com>2024-03-20 21:49:59 +0200
commitceeaf1b65787d3ef46dd0bdbd0e6810137163fea (patch)
tree7a3e10733a58f622b79c16d9e87ad3f1b7e17448 /src/plugins/platforms/ios/optional
parentcd5dd8b95bbda1e9531af52c251ea926f125c8ea (diff)
QAbstractFileEngineIterator: add `bool advance()` virtual method
And remove hasNext/next() methods. This remodels QAFEI to be like QFileSystemIterator. This better fits the logic in the newly added QDirListing class (which uses STL-style iterators). QFSFileEngineIterator: Initialize the internal nativeIterator in the constructor; also replace the advance() private method with an override for the advance() method inherited from the base class. QResourceFileEngineIterator: Override currentFileInfo(), with a QResouces the QFileInfo is created on demand if/when this method is called. This is the backend/private API, and QDirListing is the public API that can be used in a ranged-for to iterate over directory entries. Change-Id: I93eb7bdd64823ac01eea2dcaaa6bcc8ad868b2c4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms/ios/optional')
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
index 87cc6d5bea..f7e112ab81 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
@@ -270,8 +270,11 @@ public:
g_iteratorCurrentUrl.setLocalData(QString());
}
- QString next() override
+ bool advance() override
{
+ if (!m_enumerator->hasNext())
+ return false;
+
// Cache the URL that we are about to return, since QDir will immediately create a
// new file engine on the file and ask if it exists. Unless we do this, we end up
// creating a new ALAsset just to verify its existence, which will be especially
@@ -279,12 +282,7 @@ public:
ALAsset *asset = m_enumerator->next();
QString url = QUrl::fromNSURL([asset valueForProperty:ALAssetPropertyAssetURL]).toString();
g_iteratorCurrentUrl.setLocalData(url);
- return url;
- }
-
- bool hasNext() const override
- {
- return m_enumerator->hasNext();
+ return true;
}
QString currentFileName() const override