w1146869587
2021-11-05 cbf39419a8299e7d119618e5e8e1b1eb35f72f45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef EFSW_DIRWATCHERGENERIC_HPP
#define EFSW_DIRWATCHERGENERIC_HPP
 
#include <efsw/WatcherGeneric.hpp>
#include <efsw/FileInfo.hpp>
#include <efsw/DirectorySnapshot.hpp>
#include <map>
 
namespace efsw {
 
class DirWatcherGeneric
{
    public:
        typedef std::map<std::string, DirWatcherGeneric*> DirWatchMap;
 
        DirWatcherGeneric *    Parent;
        WatcherGeneric *    Watch;
        DirectorySnapshot    DirSnap;
        DirWatchMap            Directories;
        bool                Recursive;
 
        DirWatcherGeneric( DirWatcherGeneric * parent, WatcherGeneric * ws, const std::string& directory, bool recursive, bool reportNewFiles = false );
 
        ~DirWatcherGeneric();
 
        void watch( bool reportOwnChange = false );
 
        void watchDir( std::string& dir );
 
        static bool isDir( const std::string& directory );
 
        bool pathInWatches( std::string path );
 
        void addChilds( bool reportNewFiles = true );
 
        DirWatcherGeneric * findDirWatcher( std::string dir );
 
        DirWatcherGeneric * findDirWatcherFast( std::string dir );
    protected:
        bool                Deleted;
 
        DirWatcherGeneric * createDirectory( std::string newdir );
 
        void removeDirectory( std::string dir );
 
        void moveDirectory( std::string oldDir, std::string newDir );
 
        void resetDirectory( std::string directory );
 
        void handleAction( const std::string& filename, unsigned long action, std::string oldFilename = "");
};
 
}
 
#endif