openshot-audio  0.1.4
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) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_DIRECTORYCONTENTSLIST_H_INCLUDED
26 #define JUCE_DIRECTORYCONTENTSLIST_H_INCLUDED
27 
28 
29 //==============================================================================
40  private TimeSliceClient
41 {
42 public:
43  //==============================================================================
62  DirectoryContentsList (const FileFilter* fileFilter,
63  TimeSliceThread& threadToUse);
64 
67 
68 
69  //==============================================================================
71  const File& getDirectory() const noexcept { return root; }
72 
78  void setDirectory (const File& directory,
79  bool includeDirectories,
80  bool includeFiles);
81 
85  bool isFindingDirectories() const noexcept { return (fileTypeFlags & File::findDirectories) != 0; }
86 
90  bool isFindingFiles() const noexcept { return (fileTypeFlags & File::findFiles) != 0; }
91 
93  void clear();
94 
96  void refresh();
97 
99  bool isStillLoading() const;
100 
104  void setIgnoresHiddenFiles (bool shouldIgnoreHiddenFiles);
105 
109  bool ignoresHiddenFiles() const;
110 
118  void setFileFilter (const FileFilter* newFileFilter);
119 
120  //==============================================================================
123  struct FileInfo
124  {
125  //==============================================================================
134 
137 
142 
147 
150 
153  };
154 
155  //==============================================================================
165  int getNumFiles() const noexcept { return files.size(); }
166 
177  bool getFileInfo (int index, FileInfo& resultInfo) const;
178 
185  File getFile (int index) const;
186 
190  const FileFilter* getFilter() const noexcept { return fileFilter; }
191 
193  bool contains (const File&) const;
194 
195  //==============================================================================
197  TimeSliceThread& getTimeSliceThread() const noexcept { return thread; }
198 
199 private:
200  File root;
201  const FileFilter* fileFilter;
202  TimeSliceThread& thread;
203  int fileTypeFlags;
204 
205  CriticalSection fileListLock;
206  OwnedArray<FileInfo> files;
207 
208  ScopedPointer<DirectoryIterator> fileFindHandle;
209  bool volatile shouldStop;
210 
211  int useTimeSlice() override;
212  void stopSearching();
213  void changed();
214  bool checkNextFile (bool& hasChanged);
215  bool addFile (const File&, bool isDir, int64 fileSize, Time modTime,
216  Time creationTime, bool isReadOnly);
217  void setTypeFlags (int);
218 
220 };
221 
222 
223 #endif // JUCE_DIRECTORYCONTENTSLIST_H_INCLUDED
Definition: juce_File.h:534
Definition: juce_TimeSliceThread.h:47
int64 fileSize
Definition: juce_DirectoryContentsList.h:136
#define noexcept
Definition: juce_CompilerSupport.h:141
const File & getDirectory() const noexcept
Definition: juce_DirectoryContentsList.h:71
Definition: juce_DirectoryContentsList.h:39
Definition: juce_Time.h:41
const FileFilter * getFilter() const noexcept
Definition: juce_DirectoryContentsList.h:190
Definition: juce_DirectoryContentsList.h:123
Definition: juce_FileFilter.h:42
Definition: juce_String.h:43
Definition: juce_ChangeBroadcaster.h:35
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_CriticalSection.h:47
TimeSliceThread & getTimeSliceThread() const noexcept
Definition: juce_DirectoryContentsList.h:197
Definition: juce_File.h:533
bool isReadOnly
Definition: juce_DirectoryContentsList.h:152
long long int64
Definition: juce_MathsFunctions.h:60
bool isDirectory
Definition: juce_DirectoryContentsList.h:149
int getNumFiles() const noexcept
Definition: juce_DirectoryContentsList.h:165
Definition: juce_OwnedArray.h:55
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_TimeSliceThread.h:84
Time creationTime
Definition: juce_DirectoryContentsList.h:146
Time modificationTime
Definition: juce_DirectoryContentsList.h:141
bool isFindingDirectories() const noexcept
Definition: juce_DirectoryContentsList.h:85
Definition: juce_File.h:45
bool isFindingFiles() const noexcept
Definition: juce_DirectoryContentsList.h:90
String filename
Definition: juce_DirectoryContentsList.h:133