LMMS
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 //==============================================================================
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
88
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 //==============================================================================
168
179 bool getFileInfo (int index, FileInfo& resultInfo) const;
180
187 File getFile (int index) const;
188
193
195 bool contains (const File&) const;
196
197 //==============================================================================
200
201private:
203 const FileFilter* fileFilter = nullptr;
206
209
210 std::unique_ptr<RangedDirectoryIterator> fileFindHandle;
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
#define noexcept
Definition DistrhoDefines.h:72
ChangeBroadcaster() noexcept
Definition juce_ChangeBroadcaster.cpp:26
Definition juce_CriticalSection.h:43
const File & getDirectory() const noexcept
Definition juce_DirectoryContentsList.h:73
bool isFindingFiles() const noexcept
Definition juce_DirectoryContentsList.h:92
void stopSearching()
Definition juce_DirectoryContentsList.cpp:87
bool checkNextFile(bool &hasChanged)
Definition juce_DirectoryContentsList.cpp:203
bool getFileInfo(int index, FileInfo &resultInfo) const
Definition juce_DirectoryContentsList.cpp:133
OwnedArray< FileInfo > files
Definition juce_DirectoryContentsList.h:208
std::unique_ptr< RangedDirectoryIterator > fileFindHandle
Definition juce_DirectoryContentsList.h:210
void changed()
Definition juce_DirectoryContentsList.cpp:172
bool addFile(const File &, bool isDir, int64 fileSize, Time modTime, Time creationTime, bool isReadOnly)
Definition juce_DirectoryContentsList.cpp:234
bool wasEmpty
Definition juce_DirectoryContentsList.h:213
int getNumFiles() const noexcept
Definition juce_DirectoryContentsList.cpp:127
std::atomic< bool > shouldStop
Definition juce_DirectoryContentsList.h:211
File root
Definition juce_DirectoryContentsList.h:202
File getFile(int index) const
Definition juce_DirectoryContentsList.cpp:146
TimeSliceThread & getTimeSliceThread() const noexcept
Definition juce_DirectoryContentsList.h:199
bool isFindingDirectories() const noexcept
Definition juce_DirectoryContentsList.h:87
DirectoryContentsList(const FileFilter *fileFilter, TimeSliceThread &threadToUse)
Definition juce_DirectoryContentsList.cpp:29
const FileFilter * getFilter() const noexcept
Definition juce_DirectoryContentsList.h:192
int fileTypeFlags
Definition juce_DirectoryContentsList.h:205
CriticalSection fileListLock
Definition juce_DirectoryContentsList.h:207
TimeSliceThread & thread
Definition juce_DirectoryContentsList.h:204
const FileFilter * fileFilter
Definition juce_DirectoryContentsList.h:203
void setTypeFlags(int)
Definition juce_DirectoryContentsList.cpp:78
int useTimeSlice() override
Definition juce_DirectoryContentsList.cpp:178
Definition juce_FileFilter.h:38
Definition juce_File.h:45
@ ignoreHiddenFiles
Definition juce_File.h:562
@ findDirectories
Definition juce_File.h:559
@ findFiles
Definition juce_File.h:560
Definition juce_OwnedArray.h:51
Definition juce_String.h:53
Definition juce_Time.h:37
Definition juce_TimeSliceThread.h:44
friend class TimeSliceThread
Definition juce_TimeSliceThread.h:68
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
long long int64
Definition juce_MathsFunctions.h:54
Definition juce_DirectoryContentsList.h:126
String filename
Definition juce_DirectoryContentsList.h:135
Time creationTime
Definition juce_DirectoryContentsList.h:148
Time modificationTime
Definition juce_DirectoryContentsList.h:143
bool isDirectory
Definition juce_DirectoryContentsList.h:151
int64 fileSize
Definition juce_DirectoryContentsList.h:138
bool isReadOnly
Definition juce_DirectoryContentsList.h:154
#define const
Definition zconf.h:137