home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / system / filewatcher.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  837 b   |  46 lines

  1. #ifndef f_VD2_SYSTEM_FILEWATCHER_H
  2. #define f_VD2_SYSTEM_FILEWATCHER_H
  3.  
  4. #ifdef _MSC_VER
  5.     #pragma once
  6. #endif
  7.  
  8. #include <vd2/system/vdtypes.h>
  9. #include <vd2/system/VDString.h>
  10.  
  11. class VDFunctionThunk;
  12.  
  13. class IVDFileWatcherCallback {
  14. public:
  15.     virtual bool OnFileUpdated(const wchar_t *path) = 0;
  16. };
  17.  
  18. class VDFileWatcher {
  19. public:
  20.     VDFileWatcher();
  21.     ~VDFileWatcher();
  22.  
  23.     bool IsActive() const;
  24.  
  25.     void Init(const wchar_t *file, IVDFileWatcherCallback *cb);
  26.     void Shutdown();
  27.  
  28.     bool Wait(uint32 delay = 0xFFFFFFFFU);
  29.  
  30. protected:
  31.     void StaticTimerCallback(void *, unsigned, unsigned, unsigned long);
  32.  
  33.     void *mChangeHandle;
  34.     uint64 mLastWriteTime;
  35.     VDStringW mPath;
  36.  
  37.     IVDFileWatcherCallback *mpCB;
  38.  
  39.     bool mbRepeatRequested;
  40.     bool mbThunksInited;
  41.     VDFunctionThunk *mpThunk;
  42.     uint32 mTimerId;
  43. };
  44.  
  45. #endif
  46.