diff options
Diffstat (limited to 'src/3rdParty/efsw/DirWatcherGeneric.hpp')
-rwxr-xr-x | src/3rdParty/efsw/DirWatcherGeneric.hpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/3rdParty/efsw/DirWatcherGeneric.hpp b/src/3rdParty/efsw/DirWatcherGeneric.hpp new file mode 100755 index 0000000..ca52de7 --- /dev/null +++ b/src/3rdParty/efsw/DirWatcherGeneric.hpp | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef EFSW_DIRWATCHERGENERIC_HPP | ||
2 | #define EFSW_DIRWATCHERGENERIC_HPP | ||
3 | |||
4 | #include <efsw/DirectorySnapshot.hpp> | ||
5 | #include <efsw/FileInfo.hpp> | ||
6 | #include <efsw/WatcherGeneric.hpp> | ||
7 | #include <map> | ||
8 | |||
9 | namespace efsw { | ||
10 | |||
11 | class DirWatcherGeneric { | ||
12 | public: | ||
13 | typedef std::map<std::string, DirWatcherGeneric*> DirWatchMap; | ||
14 | |||
15 | DirWatcherGeneric* Parent; | ||
16 | WatcherGeneric* Watch; | ||
17 | DirectorySnapshot DirSnap; | ||
18 | DirWatchMap Directories; | ||
19 | bool Recursive; | ||
20 | |||
21 | DirWatcherGeneric( DirWatcherGeneric* parent, WatcherGeneric* ws, const std::string& directory, | ||
22 | bool recursive, bool reportNewFiles = false ); | ||
23 | |||
24 | ~DirWatcherGeneric(); | ||
25 | |||
26 | void watch( bool reportOwnChange = false ); | ||
27 | |||
28 | void watchDir( std::string& dir ); | ||
29 | |||
30 | static bool isDir( const std::string& directory ); | ||
31 | |||
32 | bool pathInWatches( std::string path ); | ||
33 | |||
34 | void addChilds( bool reportNewFiles = true ); | ||
35 | |||
36 | DirWatcherGeneric* findDirWatcher( std::string dir ); | ||
37 | |||
38 | DirWatcherGeneric* findDirWatcherFast( std::string dir ); | ||
39 | |||
40 | protected: | ||
41 | bool Deleted; | ||
42 | |||
43 | DirWatcherGeneric* createDirectory( std::string newdir ); | ||
44 | |||
45 | void removeDirectory( std::string dir ); | ||
46 | |||
47 | void moveDirectory( std::string oldDir, std::string newDir ); | ||
48 | |||
49 | void resetDirectory( std::string directory ); | ||
50 | |||
51 | void handleAction( const std::string& filename, unsigned long action, | ||
52 | std::string oldFilename = "" ); | ||
53 | }; | ||
54 | |||
55 | } // namespace efsw | ||
56 | |||
57 | #endif | ||