LMMS
Loading...
Searching...
No Matches
juce_DirectoryIterator.h
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
26#ifndef DOXYGEN
27
28//==============================================================================
56{
57public:
58 //==============================================================================
76 [[deprecated ("This class is now deprecated in favour of RangedDirectoryIterator.")]]
77 DirectoryIterator (const File& directory,
78 bool recursive,
79 const String& pattern = "*",
82 : DirectoryIterator (directory, recursive, pattern, type, follow, nullptr)
83 {
84 }
85
91 bool next();
92
105 bool next (bool* isDirectory,
106 bool* isHidden,
107 int64* fileSize,
108 Time* modTime,
109 Time* creationTime,
110 bool* isReadOnly);
111
116 const File& getFile() const;
117
123 float getEstimatedProgress() const;
124
125private:
126 using KnownPaths = std::set<File>;
127
128 DirectoryIterator (const File& directory,
129 bool recursive,
130 const String& pattern,
131 int type,
133 KnownPaths* seenPaths)
135 fileFinder (directory, (recursive || wildCards.size() > 1) ? "*" : pattern),
137 path (File::addTrailingSeparator (directory.getFullPathName())),
139 isRecursive (recursive),
140 followSymlinks (follow),
141 knownPaths (seenPaths)
142 {
143 // you have to specify the type of files you're looking for!
145 jassert (whatToLookFor > 0 && whatToLookFor <= 7);
146
148 {
149 if (knownPaths == nullptr)
150 {
151 heapKnownPaths = std::make_unique<KnownPaths>();
153 }
154
155 knownPaths->insert (directory);
156 }
157 }
158
159 //==============================================================================
161 {
162 NativeIterator (const File& directory, const String& wildCard);
164
165 bool next (String& filenameFound,
166 bool* isDirectory, bool* isHidden, int64* fileSize,
167 Time* modTime, Time* creationTime, bool* isReadOnly);
168
169 class Pimpl;
170 std::unique_ptr<Pimpl> pimpl;
171
173 };
174
178 int index = -1;
179 mutable int totalNumFiles = -1;
180 const int whatToLookFor;
181 const bool isRecursive;
182 bool hasBeenAdvanced = false;
183 std::unique_ptr<DirectoryIterator> subIterator;
187 std::unique_ptr<KnownPaths> heapKnownPaths;
188
190 static bool fileMatches (const StringArray& wildCards, const String& filename);
191
193};
194
195#endif
196
197} // namespace juce
#define final
Definition DistrhoDefines.h:74
#define nullptr
Definition DistrhoDefines.h:75
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
Definition juce_linux_CommonFile.cpp:73
NativeIterator fileFinder
Definition juce_DirectoryIterator.h:176
const int whatToLookFor
Definition juce_DirectoryIterator.h:180
std::set< File > KnownPaths
Definition juce_DirectoryIterator.h:126
StringArray wildCards
Definition juce_DirectoryIterator.h:175
std::unique_ptr< KnownPaths > heapKnownPaths
Definition juce_DirectoryIterator.h:187
File::FollowSymlinks followSymlinks
Definition juce_DirectoryIterator.h:185
static bool fileMatches(const StringArray &wildCards, const String &filename)
Definition juce_DirectoryIterator.cpp:35
String wildCard
Definition juce_DirectoryIterator.h:177
DirectoryIterator(const File &directory, bool recursive, const String &pattern="*", int type=File::findFiles, File::FollowSymlinks follow=File::FollowSymlinks::yes)
Definition juce_DirectoryIterator.h:77
KnownPaths * knownPaths
Definition juce_DirectoryIterator.h:186
static StringArray parseWildcards(const String &pattern)
Definition juce_DirectoryIterator.cpp:26
const bool isRecursive
Definition juce_DirectoryIterator.h:181
String path
Definition juce_DirectoryIterator.h:177
int index
Definition juce_DirectoryIterator.h:178
bool hasBeenAdvanced
Definition juce_DirectoryIterator.h:182
File currentFile
Definition juce_DirectoryIterator.h:184
int totalNumFiles
Definition juce_DirectoryIterator.h:179
std::unique_ptr< DirectoryIterator > subIterator
Definition juce_DirectoryIterator.h:183
DirectoryIterator(const File &directory, bool recursive, const String &pattern, int type, File::FollowSymlinks follow, KnownPaths *seenPaths)
Definition juce_DirectoryIterator.h:128
Definition juce_File.h:45
@ findDirectories
Definition juce_File.h:559
@ findFiles
Definition juce_File.h:560
FollowSymlinks
Definition juce_File.h:566
@ yes
Definition juce_File.h:579
@ noCycles
Definition juce_File.h:573
Definition juce_StringArray.h:35
Definition juce_String.h:53
Definition juce_Time.h:37
static char filename[]
Definition features.c:5
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
long long int64
Definition juce_MathsFunctions.h:54
Definition juce_DirectoryIterator.h:161
std::unique_ptr< Pimpl > pimpl
Definition juce_DirectoryIterator.h:170
bool next(String &filenameFound, bool *isDirectory, bool *isHidden, int64 *fileSize, Time *modTime, Time *creationTime, bool *isReadOnly)
Definition juce_linux_CommonFile.cpp:136
NativeIterator(const File &directory, const String &wildCard)
Definition juce_linux_CommonFile.cpp:129
ulg size
Definition extract.c:2350
int * pattern
Definition match.c:126