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
Public Types | Public Member Functions | List of all members
juce::RangedDirectoryIterator Class Referencefinal

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 value_type = DirectoryEntry
 
using reference = DirectoryEntry
 
using pointer = void
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 RangedDirectoryIterator ()=default
 The default-constructed iterator acts as the 'end' sentinel.
 
 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.
 
bool operator== (const RangedDirectoryIterator &other) const noexcept
 Returns true if both iterators are in their end/sentinel state, otherwise returns false.
 
bool operator!= (const RangedDirectoryIterator &other) const noexcept
 Returns the inverse of operator==.
 
const DirectoryEntryoperator* () const noexcept
 Return an object containing metadata about the file or folder to which the iterator is currently pointing.
 
const DirectoryEntryoperator-> () const noexcept
 
RangedDirectoryIteratoroperator++ ()
 Moves the iterator along to the next file.
 
DirectoryEntry operator++ (int)
 Moves the iterator along to the next file.
 

Detailed Description

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.

for (DirectoryEntry entry : RangedDirectoryIterator (File ("/path/to/folder"), isRecursive))
if (entry.isHidden())
hiddenFiles.push_back (entry.getFile());
Describes the attributes of a file or folder.
Represents a local file or directory.
Definition juce_File.h:45
Allows iterating over files and folders using C++11 range-for syntax.
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

@tags{Core}

Definition at line 99 of file juce_RangedDirectoryIterator.h.

Member Typedef Documentation

◆ difference_type

Definition at line 102 of file juce_RangedDirectoryIterator.h.

◆ iterator_category

Definition at line 106 of file juce_RangedDirectoryIterator.h.

◆ pointer

using juce::RangedDirectoryIterator::pointer = void

Definition at line 105 of file juce_RangedDirectoryIterator.h.

◆ reference

Definition at line 104 of file juce_RangedDirectoryIterator.h.

◆ value_type

Definition at line 103 of file juce_RangedDirectoryIterator.h.

Constructor & Destructor Documentation

◆ RangedDirectoryIterator()

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.

Parameters
directorythe directory to search in
isRecursivewhether all the subdirectories should also be searched
wildCardthe file pattern to match. This may contain multiple patterns separated by a semi-colon or comma, e.g. "*.jpg;*.png"
whatToLookFora value from the File::TypesOfFileToFind enum, specifying whether to look for files, directories, or both.
followSymlinksthe policy to use when symlinks are encountered

Definition at line 39 of file juce_RangedDirectoryIterator.cpp.

Member Function Documentation

◆ operator!=()

bool juce::RangedDirectoryIterator::operator!= ( const RangedDirectoryIterator other) const
noexcept

Returns the inverse of operator==.

Definition at line 138 of file juce_RangedDirectoryIterator.h.

◆ operator*()

const DirectoryEntry & juce::RangedDirectoryIterator::operator* ( ) const
noexcept

Return an object containing metadata about the file or folder to which the iterator is currently pointing.

Definition at line 146 of file juce_RangedDirectoryIterator.h.

◆ operator++() [1/2]

RangedDirectoryIterator & juce::RangedDirectoryIterator::operator++ ( )

Moves the iterator along to the next file.

Definition at line 150 of file juce_RangedDirectoryIterator.h.

◆ operator++() [2/2]

DirectoryEntry juce::RangedDirectoryIterator::operator++ ( int  )

Moves the iterator along to the next file.

Returns
an object containing metadata about the file or folder to to which the iterator was previously pointing.

Definition at line 161 of file juce_RangedDirectoryIterator.h.

◆ operator->()

const DirectoryEntry * juce::RangedDirectoryIterator::operator-> ( ) const
noexcept

Definition at line 147 of file juce_RangedDirectoryIterator.h.

◆ operator==()

bool juce::RangedDirectoryIterator::operator== ( const RangedDirectoryIterator other) const
noexcept

Returns true if both iterators are in their end/sentinel state, otherwise returns false.

Definition at line 132 of file juce_RangedDirectoryIterator.h.


The documentation for this class was generated from the following files: