55class JUCE_API DirectoryIterator
final
76 [[deprecated (
"This class is now deprecated in favour of RangedDirectoryIterator.")]]
77 DirectoryIterator (
const File& directory,
79 const String& pattern =
"*",
80 int type = File::findFiles,
81 File::FollowSymlinks follow = File::FollowSymlinks::yes)
82 : DirectoryIterator (directory, recursive, pattern, type, follow, nullptr)
105 bool next (
bool* isDirectory,
116 const File& getFile()
const;
123 float getEstimatedProgress()
const;
128 DirectoryIterator (
const File& directory,
130 const String& pattern,
132 File::FollowSymlinks follow,
133 KnownPaths* seenPaths)
134 : wildCards (parseWildcards (pattern)),
135 fileFinder (directory, (recursive || wildCards.
size() > 1) ?
"*" : pattern),
137 path (File::addTrailingSeparator (directory.getFullPathName())),
138 whatToLookFor (type),
139 isRecursive (recursive),
140 followSymlinks (follow),
141 knownPaths (seenPaths)
144 jassert ((whatToLookFor & (File::findFiles | File::findDirectories)) != 0);
145 jassert (whatToLookFor > 0 && whatToLookFor <= 7);
147 if (followSymlinks == File::FollowSymlinks::noCycles)
149 if (knownPaths ==
nullptr)
151 heapKnownPaths = std::make_unique<KnownPaths>();
152 knownPaths = heapKnownPaths.get();
155 knownPaths->insert (directory);
160 struct NativeIterator
162 NativeIterator (
const File& directory,
const String& wildCard);
165 bool next (String& filenameFound,
166 bool* isDirectory,
bool* isHidden, int64* fileSize,
167 Time* modTime, Time* creationTime,
bool* isReadOnly);
175 StringArray wildCards;
176 NativeIterator fileFinder;
177 String wildCard, path;
179 mutable int totalNumFiles = -1;
180 const int whatToLookFor;
181 const bool isRecursive;
182 bool hasBeenAdvanced =
false;
185 File::FollowSymlinks followSymlinks = File::FollowSymlinks::yes;
186 KnownPaths* knownPaths =
nullptr;
189 static StringArray parseWildcards (
const String& pattern);
190 static bool fileMatches (
const StringArray& wildCards,
const String& filename);
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...