JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_RangedDirectoryIterator.cpp
Go to the documentation of this file.
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
23namespace juce
24{
25
26JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
27JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
28
29float 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!
40 bool isRecursive,
41 const String& wildCard,
42 int whatToLookFor,
44 : iterator (new DirectoryIterator (directory,
45 isRecursive,
46 wildCard,
49{
50 entry.iterator = iterator;
51 increment();
52}
53
54bool 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
70void 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
Describes the attributes of a file or folder.
float getEstimatedProgress() const
The estimated proportion of the range that has been visited by the iterator, from 0....
Represents a local file or directory.
Definition juce_File.h:45
RangedDirectoryIterator()=default
The default-constructed iterator acts as the 'end' sentinel.
The JUCE String class!
Definition juce_String.h:53
JUCE Namespace.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88