Loading...
Searching...
No Matches
juce::RangedDirectoryIterator Class Referencefinal

## 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.

std::vector<File> hiddenFiles;
for (DirectoryEntry entry : RangedDirectoryIterator (File ("/path/to/folder"), isRecursive))
if (entry.isHidden())
hiddenFiles.push_back (entry.getFile());
juce::DirectoryEntry
Describes the attributes of a file or folder.
Definition juce_RangedDirectoryIterator.h:47
juce::File
Represents a local file or directory.
Definition juce_File.h:59
juce::RangedDirectoryIterator::RangedDirectoryIterator
RangedDirectoryIterator()=default
The default-constructed iterator acts as the 'end' sentinel.

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

- juce_core/files/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 DirectoryEntry & | operator* () const noexcept
| Return an object containing metadata about the file or folder to which the iterator is currently pointing.
const DirectoryEntry * | operator-> () const noexcept
RangedDirectoryIterator & | operator++ ()
| Moves the iterator along to the next file.
DirectoryEntry | operator++ (int)
| Moves the iterator along to the next file.

## Member Typedef Documentation

## difference_type

using juce::RangedDirectoryIterator::difference_type = std::ptrdiff_t

## value_type

using juce::RangedDirectoryIterator::value_type = DirectoryEntry

## reference

using juce::RangedDirectoryIterator::reference = DirectoryEntry

## pointer

using juce::RangedDirectoryIterator::pointer = void

## iterator_category

using juce::RangedDirectoryIterator::iterator_category = std::input_iterator_tag

## Constructors and Destructors

## RangedDirectoryIterator() [1/2]

juce::RangedDirectoryIterator::RangedDirectoryIterator | ( |  | ) |

default

The default-constructed iterator acts as the 'end' sentinel.

Referenced by operator!=(), operator++(), and operator==().

## RangedDirectoryIterator() [2/2]

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

  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

References juce::File::findFiles, and juce::File::yes.

## Member Functions

## operator==()

bool juce::RangedDirectoryIterator::operator== | ( | const RangedDirectoryIterator & | other | ) | const

inline noexcept

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

References RangedDirectoryIterator().

## operator!=()

bool juce::RangedDirectoryIterator::operator!= | ( | const RangedDirectoryIterator & | other | ) | const

inline noexcept

Returns the inverse of operator==.

References RangedDirectoryIterator().

## operator*()

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

inline noexcept

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

## operator->()

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

inline noexcept

## operator++() [1/2]

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

inline

Moves the iterator along to the next file.

References RangedDirectoryIterator().

## operator++() [2/2]

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

inline

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.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited