aboutsummaryrefslogtreecommitdiff
path: root/src/3rdParty/efsw/WatcherWin32.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdParty/efsw/WatcherWin32.hpp')
-rw-r--r--[-rwxr-xr-x]src/3rdParty/efsw/WatcherWin32.hpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/3rdParty/efsw/WatcherWin32.hpp b/src/3rdParty/efsw/WatcherWin32.hpp
index 71e13be..ea1e8e4 100755..100644
--- a/src/3rdParty/efsw/WatcherWin32.hpp
+++ b/src/3rdParty/efsw/WatcherWin32.hpp
@@ -3,6 +3,7 @@
3 3
4#include <efsw/FileInfo.hpp> 4#include <efsw/FileInfo.hpp>
5#include <efsw/FileWatcherImpl.hpp> 5#include <efsw/FileWatcherImpl.hpp>
6#include <vector>
6 7
7#if EFSW_PLATFORM == EFSW_PLATFORM_WIN32 8#if EFSW_PLATFORM == EFSW_PLATFORM_WIN32
8 9
@@ -21,6 +22,8 @@ namespace efsw {
21 22
22class WatcherWin32; 23class WatcherWin32;
23 24
25enum RefreshResult { Failed, Success, SucessEx };
26
24/// Internal watch data 27/// Internal watch data
25struct WatcherStructWin32 { 28struct WatcherStructWin32 {
26 OVERLAPPED Overlapped; 29 OVERLAPPED Overlapped;
@@ -32,39 +35,41 @@ struct sLastModifiedEvent {
32 std::string fileName; 35 std::string fileName;
33}; 36};
34 37
35bool RefreshWatch( WatcherStructWin32* pWatch ); 38RefreshResult RefreshWatch( WatcherStructWin32* pWatch );
36 39
37void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped ); 40void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped );
38 41
39void DestroyWatch( WatcherStructWin32* pWatch ); 42void DestroyWatch( WatcherStructWin32* pWatch );
40 43
41WatcherStructWin32* CreateWatch( LPCWSTR szDirectory, bool recursive, DWORD NotifyFilter, 44WatcherStructWin32* CreateWatch( LPCWSTR szDirectory, bool recursive,
42 HANDLE iocp ); 45 DWORD bufferSize, DWORD notifyFilter, HANDLE iocp );
43 46
44class WatcherWin32 : public Watcher { 47class WatcherWin32 : public Watcher {
45 public: 48 public:
46 WatcherWin32() : 49 WatcherWin32(DWORD dwBufferSize) :
47 Struct( NULL ), 50 Struct( NULL ),
48 DirHandle( NULL ), 51 DirHandle( NULL ),
52 Buffer(),
49 lParam( 0 ), 53 lParam( 0 ),
50 NotifyFilter( 0 ), 54 NotifyFilter( 0 ),
51 StopNow( false ), 55 StopNow( false ),
56 Extended( false ),
52 Watch( NULL ), 57 Watch( NULL ),
53 DirName( NULL ) {} 58 DirName( NULL ) {
59 Buffer.resize(dwBufferSize);
60 }
54 61
55 WatcherStructWin32* Struct; 62 WatcherStructWin32* Struct;
56 HANDLE DirHandle; 63 HANDLE DirHandle;
57 BYTE Buffer 64 std::vector<BYTE> Buffer;
58 [63 *
59 1024]; // do NOT make this bigger than 64K because it will fail if the folder being watched
60 // is on the network! (see
61 // http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465(v=vs.85).aspx)
62 LPARAM lParam; 65 LPARAM lParam;
63 DWORD NotifyFilter; 66 DWORD NotifyFilter;
64 bool StopNow; 67 bool StopNow;
68 bool Extended;
65 FileWatcherImpl* Watch; 69 FileWatcherImpl* Watch;
66 char* DirName; 70 char* DirName;
67 sLastModifiedEvent LastModifiedEvent; 71 sLastModifiedEvent LastModifiedEvent;
72 std::vector<std::pair<std::string, LARGE_INTEGER>> OldFiles;
68}; 73};
69 74
70} // namespace efsw 75} // namespace efsw