Skip to content

Commit

Permalink
RangedDirectoryIterator: Allow querying the estimated progress
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Jul 2, 2020
1 parent 6973f85 commit 9cc3fca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/juce_core/files/juce_RangedDirectoryIterator.cpp
Expand Up @@ -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)

Expand All @@ -37,6 +45,7 @@ RangedDirectoryIterator::RangedDirectoryIterator (const File& directory,
wildCard,
whatToLookFor))
{
entry.iterator = iterator;
increment();
}

Expand Down
6 changes: 6 additions & 0 deletions modules/juce_core/files/juce_RangedDirectoryIterator.h
Expand Up @@ -53,7 +53,13 @@ class DirectoryEntry final
/** 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;
Expand Down

0 comments on commit 9cc3fca

Please sign in to comment.