OpenShot Audio Library | OpenShotAudio 0.4.0
Loading...
Searching...
No Matches
juce_RangedDirectoryIterator.h
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//==============================================================================
27JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
28JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
29
36{
37public:
39 File getFile() const { return file; }
40
42 Time getModificationTime() const { return modTime; }
43
45 Time getCreationTime() const { return creationTime; }
46
48 int64 getFileSize() const { return fileSize; }
49
51 bool isDirectory() const { return directory; }
52
54 bool isHidden() const { return hidden; }
55
57 bool isReadOnly() const { return readOnly; }
58
62 float getEstimatedProgress() const;
63
64private:
65 std::weak_ptr<DirectoryIterator> iterator;
66 File file;
67 Time modTime;
68 Time creationTime;
69 int64 fileSize = 0;
70 bool directory = false;
71 bool hidden = false;
72 bool readOnly = false;
73
74 friend class RangedDirectoryIterator;
75};
76
80inline const DirectoryEntry& operator* (const DirectoryEntry& e) noexcept { return e; }
81
82//==============================================================================
100{
101public:
102 using difference_type = std::ptrdiff_t;
105 using pointer = void;
106 using iterator_category = std::input_iterator_tag;
107
110
123 RangedDirectoryIterator (const File& directory,
124 bool isRecursive,
125 const String& wildCard = "*",
126 int whatToLookFor = File::findFiles,
128
132 bool operator== (const RangedDirectoryIterator& other) const noexcept
133 {
134 return iterator == nullptr && other.iterator == nullptr;
135 }
136
138 bool operator!= (const RangedDirectoryIterator& other) const noexcept
139 {
140 return ! operator== (other);
141 }
142
146 const DirectoryEntry& operator* () const noexcept { return entry; }
147 const DirectoryEntry* operator->() const noexcept { return &entry; }
148
151 {
152 increment();
153 return *this;
154 }
155
162 {
163 auto result = *(*this);
164 ++(*this);
165 return result;
166 }
167
168private:
169 bool next();
170 void increment();
171
172 std::shared_ptr<DirectoryIterator> iterator;
173 DirectoryEntry entry;
174};
175
179inline RangedDirectoryIterator begin (const RangedDirectoryIterator& it) { return it; }
180
184inline RangedDirectoryIterator end (const RangedDirectoryIterator&) { return {}; }
185
186
187JUCE_END_IGNORE_WARNINGS_MSVC
188JUCE_END_IGNORE_WARNINGS_GCC_LIKE
189
190} // namespace juce
bool operator==(const RangedDirectoryIterator &other) const noexcept
bool operator!=(const RangedDirectoryIterator &other) const noexcept
const DirectoryEntry & operator*() const noexcept