Allows iterating over files and folders using C++11 range-for syntax. More...
#include <juce_RangedDirectoryIterator.h>
Public Types | |
using | difference_type = std::ptrdiff_t |
using | iterator_category = std::input_iterator_tag |
using | pointer = void |
using | reference = DirectoryEntry |
using | value_type = DirectoryEntry |
Public Member Functions | |
RangedDirectoryIterator ()=default | |
The default-constructed iterator acts as the 'end' sentinel. More... | |
RangedDirectoryIterator (const File &directory, bool isRecursive, const String &wildCard="*", int whatToLookFor=File::findFiles, File::FollowSymlinks followSymlinks=File::FollowSymlinks::yes) | |
Creates a RangedDirectoryIterator for a given directory. More... | |
bool | operator!= (const RangedDirectoryIterator &other) const noexcept |
Returns the inverse of operator==. More... | |
const DirectoryEntry & | operator* () const noexcept |
Return an object containing metadata about the file or folder to which the iterator is currently pointing. More... | |
RangedDirectoryIterator & | operator++ () |
Moves the iterator along to the next file. More... | |
DirectoryEntry | operator++ (int) |
Moves the iterator along to the next file. More... | |
const DirectoryEntry * | operator-> () const noexcept |
bool | operator== (const RangedDirectoryIterator &other) const noexcept |
Returns true if both iterators are in their end/sentinel state, otherwise returns false. More... | |
Private Member Functions | |
void | increment () |
bool | next () |
Private Attributes | |
DirectoryEntry | entry |
std::shared_ptr< DirectoryIterator > | iterator |
Allows iterating over files and folders using C++11 range-for syntax.
In the following example, we recursively find all hidden files in a specific directory.
@tags{Core}
using juce::RangedDirectoryIterator::difference_type = std::ptrdiff_t |
using juce::RangedDirectoryIterator::iterator_category = std::input_iterator_tag |
using juce::RangedDirectoryIterator::pointer = void |
|
default |
The default-constructed iterator acts as the 'end' sentinel.
juce::RangedDirectoryIterator::RangedDirectoryIterator | ( | const File & | directory, |
bool | isRecursive, | ||
const String & | wildCard = "*" , |
||
int | whatToLookFor = File::findFiles , |
||
File::FollowSymlinks | followSymlinks = File::FollowSymlinks::yes |
||
) |
Creates a RangedDirectoryIterator for a given directory.
The resulting iterator can be used directly in a 'range-for' expression.
directory | the directory to search in |
isRecursive | whether all the subdirectories should also be searched |
wildCard | the file pattern to match. This may contain multiple patterns separated by a semi-colon or comma, e.g. "*.jpg;*.png" |
whatToLookFor | a value from the File::TypesOfFileToFind enum, specifying whether to look for files, directories, or both. |
followSymlinks | the policy to use when symlinks are encountered |
|
private |
Referenced by operator++().
|
private |
|
inlinenoexcept |
Returns the inverse of operator==.
References operator==().
|
inlinenoexcept |
Return an object containing metadata about the file or folder to which the iterator is currently pointing.
References entry.
|
inline |
Moves the iterator along to the next file.
References increment().
|
inline |
Moves the iterator along to the next file.
References juce::gl::result.
|
inlinenoexcept |
References entry.
|
inlinenoexcept |
Returns true if both iterators are in their end/sentinel state, otherwise returns false.
References iterator.
Referenced by operator!=().
|
private |
Referenced by operator*(), and operator->().
|
private |
Referenced by operator==().