libmoost
|
00001 /* vim:set ts=3 sw=3 sts=3 et: */ 00028 #ifndef MOOST_IO_NOTIFY_WINDOWS_HPP__ 00029 #define MOOST_IO_NOTIFY_WINDOWS_HPP__ 00030 00031 #include "../file_watcher.hpp" 00032 00033 namespace moost { namespace io { 00034 00035 // For now this is implimeneted using file_watcher as a windows version is a bit more work :( 00036 class ionotify 00037 { 00038 public: 00039 ionotify(bool ignore_dup_events = false, bool stop_immediately = false) : fw_(50) 00040 { 00041 } 00042 00043 ~ionotify() 00044 { 00045 } 00046 00047 typedef file_watcher::file_action file_action; 00048 typedef file_watcher::callback_t callback_t; 00049 file_action static const CHANGED = file_watcher::CHANGED; 00050 file_action static const CREATED = file_watcher::CREATED; 00051 file_action static const DELETED = file_watcher::DELETED; 00052 00053 public: 00054 void insert(std::string const & path, callback_t const & callback, bool call_now = false) 00055 { 00056 fw_.insert(path, callback, call_now); 00057 } 00058 00059 void erase(std::string const & path) 00060 { 00061 fw_.erase(path); 00062 } 00063 00064 void start() 00065 { 00066 fw_.start(); 00067 } 00068 00069 void stop() 00070 { 00071 fw_.stop(); 00072 } 00073 00074 private: 00075 file_watcher fw_; 00076 }; 00077 00078 00079 }} // moost::io 00080 00081 #endif // MOOST_IO_NOTIFY_WINDOWS_HPP__