diff options
Diffstat (limited to 'dmonwrapper.h')
| -rw-r--r-- | dmonwrapper.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/dmonwrapper.h b/dmonwrapper.h new file mode 100644 index 00000000..ac588329 --- /dev/null +++ b/dmonwrapper.h @@ -0,0 +1,33 @@ +#pragma once + +#include <filesystem> +#include <functional> +#include <map> +#include <mutex> +#include <vector> +#define DMON_MAX_WATCHES 256 +#include "vendor/dmon/dmon.h" + + +typedef std::function<void(dmon_action action, std::string dirname, std::string filename, std::string oldname)> CallbackFunction; + +class DMonWrapper +{ + struct CallbackContext + { + CallbackFunction callback; + }; + + static bool DMON_INITIALIZED; + static std::mutex DMON_MUTEX; + + std::map<uint32_t, CallbackContext*> m_callbacks; + +public: + DMonWrapper(); + ~DMonWrapper(); + + dmon_watch_id Watch(const std::filesystem::path& path, CallbackFunction callback, bool recursive = false); + void Unwatch(dmon_watch_id watchId); + std::vector<dmon_watch_id> GetWatchIds(); +}; |
