OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_RangedDirectoryIterator.cpp
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23 namespace juce
24{
25
26JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
27JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
28
29 float DirectoryEntry::getEstimatedProgress() const
30{
31 if (auto it = iterator.lock())
32 return it->getEstimatedProgress();
33
34 return 0.0f;
35}
36
37// We implement this in terms of the deprecated DirectoryIterator,
38// but the old DirectoryIterator might go away in the future!
39 RangedDirectoryIterator::RangedDirectoryIterator (const File& directory,
40 bool isRecursive,
41 const String& wildCard,
42 int whatToLookFor,
43 File::FollowSymlinks followSymlinks)
44 : iterator (new DirectoryIterator (directory,
45 isRecursive,
46 wildCard,
47 whatToLookFor,
48 followSymlinks))
49{
50 entry.iterator = iterator;
51 increment();
52}
53
54 bool RangedDirectoryIterator::next()
55{
56 const auto result = iterator->next (&entry.directory,
57 &entry.hidden,
58 &entry.fileSize,
59 &entry.modTime,
60 &entry.creationTime,
61 &entry.readOnly);
62 if (result)
63 entry.file = iterator->getFile();
64 else
65 entry = {};
66
67 return result;
68}
69
70 void RangedDirectoryIterator::increment()
71{
72 if (iterator != nullptr && ! next())
73 iterator = nullptr;
74}
75
76JUCE_END_IGNORE_WARNINGS_GCC_LIKE
77JUCE_END_IGNORE_WARNINGS_MSVC
78
79} // namespace juce
juce::DirectoryEntry
Definition juce_RangedDirectoryIterator.h:36
juce::DirectoryEntry::getEstimatedProgress
float getEstimatedProgress() const
Definition juce_RangedDirectoryIterator.cpp:29
juce::DirectoryIterator
Definition juce_DirectoryIterator.h:56
juce::File
Definition juce_File.h:45
juce::File::FollowSymlinks
FollowSymlinks
Definition juce_File.h:572
juce::RangedDirectoryIterator::RangedDirectoryIterator
RangedDirectoryIterator()=default
juce::String
Definition juce_String.h:53