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
juce_DirectoryContentsList.h
Go to the documentation of this file.
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 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
42 private TimeSliceClient
43{
44public:
45 //==============================================================================
64 DirectoryContentsList (const FileFilter* fileFilter,
65 TimeSliceThread& threadToUse);
66
68 ~DirectoryContentsList() override;
69
70
71 //==============================================================================
73 const File& getDirectory() const noexcept { return root; }
74
80 void setDirectory (const File& directory,
81 bool includeDirectories,
82 bool includeFiles);
83
87 bool isFindingDirectories() const noexcept { return (fileTypeFlags & File::findDirectories) != 0; }
88
92 bool isFindingFiles() const noexcept { return (fileTypeFlags & File::findFiles) != 0; }
93
95 void clear();
96
98 void refresh();
99
101 bool isStillLoading() const;
102
106 void setIgnoresHiddenFiles (bool shouldIgnoreHiddenFiles);
107
111 bool ignoresHiddenFiles() const;
112
120 void setFileFilter (const FileFilter* newFileFilter);
121
122 //==============================================================================
125 struct FileInfo
126 {
127 //==============================================================================
136
139
144
149
152
155 };
156
157 //==============================================================================
167 int getNumFiles() const noexcept;
168
179 bool getFileInfo (int index, FileInfo& resultInfo) const;
180
187 File getFile (int index) const;
188
192 const FileFilter* getFilter() const noexcept { return fileFilter; }
193
195 bool contains (const File&) const;
196
197 //==============================================================================
199 TimeSliceThread& getTimeSliceThread() const noexcept { return thread; }
200
201private:
202 File root;
203 const FileFilter* fileFilter = nullptr;
204 TimeSliceThread& thread;
205 int fileTypeFlags = File::ignoreHiddenFiles | File::findFiles;
206
207 CriticalSection fileListLock;
208 OwnedArray<FileInfo> files;
209
211 std::atomic<bool> shouldStop { true }, isSearching { false };
212
213 bool wasEmpty = true;
214
215 int useTimeSlice() override;
216 void stopSearching();
217 void changed();
218 bool checkNextFile (bool& hasChanged);
219 bool addFile (const File&, bool isDir, int64 fileSize, Time modTime,
220 Time creationTime, bool isReadOnly);
221 void setTypeFlags (int);
222
224};
225
226} // namespace juce
Holds a list of ChangeListeners, and sends messages to them when instructed.
A class to asynchronously scan for details about the files in a directory.
const File & getDirectory() const noexcept
Returns the directory that's currently being used.
bool isFindingFiles() const noexcept
Returns true if this list contains files.
bool isFindingDirectories() const noexcept
Returns true if this list contains directories.
bool isDirectory
True if the file is a directory.
bool isReadOnly
True if the file is read-only.
Contains cached information about one of the files in a DirectoryContentsList.
Interface for deciding which files are suitable for something.
Represents a local file or directory.
Definition juce_File.h:45
The JUCE String class!
Definition juce_String.h:53
Used by the TimeSliceThread class.
A thread that keeps a list of clients, and calls each one in turn, giving them all a chance to run so...
Holds an absolute date and time.
Definition juce_Time.h:37
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
long long int64
A platform-independent 64-bit integer type.