1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

RangedDirectoryIterator: Allow querying the estimated progress

This commit is contained in:
reuk 2020-07-02 17:25:03 +01:00
parent 6973f850d7
commit 9cc3fca7d0
2 changed files with 15 additions and 0 deletions

View file

@ -23,6 +23,14 @@
namespace juce
{
float DirectoryEntry::getEstimatedProgress() const
{
if (auto it = iterator.lock())
return it->getEstimatedProgress();
return 0.0f;
}
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
@ -37,6 +45,7 @@ RangedDirectoryIterator::RangedDirectoryIterator (const File& directory,
wildCard,
whatToLookFor))
{
entry.iterator = iterator;
increment();
}

View file

@ -53,7 +53,13 @@ public:
/** True if the item is read-only, false otherwise. */
bool isReadOnly() const { return readOnly; }
/** The estimated proportion of the range that has been visited
by the iterator, from 0.0 to 1.0.
*/
float getEstimatedProgress() const;
private:
std::weak_ptr<DirectoryIterator> iterator;
File file;
Time modTime;
Time creationTime;