6#include <condition_variable>
43 using clock_t = std::chrono::steady_clock;
53 static auto watch(
const fs::path& path,
57 clock_t::duration poll_interval,
61 static auto watch(
const fs::path& path,
62 const std::string& filter_pattern,
65 clock_t::duration poll_interval,
74 static void unwatch(std::uint64_t key);
91 static void touch(
const fs::path& path,
bool recursive, fs::file_time_type time = fs::now());
140 clock_t::duration poll_interval,
152 std::condition_variable
cv_;
157 std::map<std::uint64_t, std::shared_ptr<impl>>
watchers_;
A filter that combines include and exclude patterns for file/directory filtering.
static void unwatch_impl(std::uint64_t key)
static void unwatch(std::uint64_t key)
Un-watches a previously registered file or directory.
static void unwatch_all_impl()
std::function< void(const std::vector< entry > &, bool)> notify_callback
std::atomic< bool > watching_
Atomic bool sync.
static void unwatch_all()
Un-watches all previously registered file or directory.
static void touch(const fs::path &path, bool recursive, fs::file_time_type time=fs::now())
Sets the last modification time of a file or directory. by default sets the time to the current time.
static auto watch(const fs::path &path, const std::string &filter_pattern, bool recursive, bool initial_list, clock_t::duration poll_interval, notify_callback callback) -> std::uint64_t
std::condition_variable cv_
std::map< std::uint64_t, std::shared_ptr< impl > > watchers_
std::chrono::steady_clock clock_t
static auto watch_impl(const fs::path &path, const pattern_filter &filter, bool recursive, bool initial_list, clock_t::duration poll_interval, notify_callback &list_callback) -> std::uint64_t
std::thread thread_
Thread that polls for changes.
std::mutex mutex_
Mutex for the file watchers.
static auto watch(const fs::path &path, const pattern_filter &filter, bool recursive, bool initial_list, clock_t::duration poll_interval, notify_callback callback) -> std::uint64_t
Watches a file or directory for modification and call back the specified std::function....
auto to_string(const watcher::entry &e) -> std::string
fs::file_time_type last_mod_time