diff options
Diffstat (limited to 'src/3rdParty/efsw/FileWatcherImpl.hpp')
-rwxr-xr-x | src/3rdParty/efsw/FileWatcherImpl.hpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/3rdParty/efsw/FileWatcherImpl.hpp b/src/3rdParty/efsw/FileWatcherImpl.hpp new file mode 100755 index 0000000..ea1beb8 --- /dev/null +++ b/src/3rdParty/efsw/FileWatcherImpl.hpp | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef EFSW_FILEWATCHERIMPL_HPP | ||
2 | #define EFSW_FILEWATCHERIMPL_HPP | ||
3 | |||
4 | #include <efsw/Atomic.hpp> | ||
5 | #include <efsw/Mutex.hpp> | ||
6 | #include <efsw/Thread.hpp> | ||
7 | #include <efsw/Watcher.hpp> | ||
8 | #include <efsw/base.hpp> | ||
9 | #include <efsw/efsw.hpp> | ||
10 | |||
11 | namespace efsw { | ||
12 | |||
13 | class FileWatcherImpl { | ||
14 | public: | ||
15 | FileWatcherImpl( FileWatcher* parent ); | ||
16 | |||
17 | virtual ~FileWatcherImpl(); | ||
18 | |||
19 | /// Add a directory watch | ||
20 | /// On error returns WatchID with Error type. | ||
21 | virtual WatchID addWatch( const std::string& directory, FileWatchListener* watcher, | ||
22 | bool recursive ) = 0; | ||
23 | |||
24 | /// Remove a directory watch. This is a brute force lazy search O(nlogn). | ||
25 | virtual void removeWatch( const std::string& directory ) = 0; | ||
26 | |||
27 | /// Remove a directory watch. This is a map lookup O(logn). | ||
28 | virtual void removeWatch( WatchID watchid ) = 0; | ||
29 | |||
30 | /// Updates the watcher. Must be called often. | ||
31 | virtual void watch() = 0; | ||
32 | |||
33 | /// Handles the action | ||
34 | virtual void handleAction( Watcher* watch, const std::string& filename, unsigned long action, | ||
35 | std::string oldFilename = "" ) = 0; | ||
36 | |||
37 | /// @return Returns a list of the directories that are being watched | ||
38 | virtual std::list<std::string> directories() = 0; | ||
39 | |||
40 | /// @return true if the backend init successfully | ||
41 | virtual bool initOK(); | ||
42 | |||
43 | /// @return If the link is allowed according to the current path and the state of out scope | ||
44 | /// links | ||
45 | virtual bool linkAllowed( const std::string& curPath, const std::string& link ); | ||
46 | |||
47 | /// Search if a directory already exists in the watches | ||
48 | virtual bool pathInWatches( const std::string& path ) = 0; | ||
49 | |||
50 | FileWatcher* mFileWatcher; | ||
51 | Atomic<bool> mInitOK; | ||
52 | bool mIsGeneric; | ||
53 | }; | ||
54 | |||
55 | } // namespace efsw | ||
56 | |||
57 | #endif | ||