#include <watcher.h>
|
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. A list of modified files or directory is passed as argument of the callback. Use this version only if you are watching multiple files or a directory.
|
|
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 |
|
static void | unwatch (std::uint64_t key) |
| Un-watches a previously registered file or directory.
|
|
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 void | pause () |
|
static void | resume () |
|
|
std::mutex | mutex_ |
| Mutex for the file watchers.
|
|
std::atomic< bool > | watching_ = {false} |
| Atomic bool sync.
|
|
std::condition_variable | cv_ |
|
std::thread | thread_ |
| Thread that polls for changes.
|
|
std::map< std::uint64_t, std::shared_ptr< impl > > | watchers_ |
|
Definition at line 20 of file watcher.h.
◆ clock_t
◆ notify_callback
◆ entry_status
Enumerator |
---|
created | |
modified | |
removed | |
renamed | |
unmodified | |
Definition at line 23 of file watcher.h.
◆ ~watcher()
fs::watcher::~watcher |
( |
| ) |
|
◆ watcher()
◆ close()
void fs::watcher::close |
( |
| ) |
|
|
protected |
◆ pause()
void fs::watcher::pause |
( |
| ) |
|
|
static |
◆ resume()
void fs::watcher::resume |
( |
| ) |
|
|
static |
◆ start()
void fs::watcher::start |
( |
| ) |
|
|
protected |
◆ touch()
void fs::watcher::touch |
( |
const fs::path & | path, |
|
|
bool | recursive, |
|
|
fs::file_time_type | time = fs::now() ) |
|
static |
Sets the last modification time of a file or directory. by default sets the time to the current time.
Definition at line 436 of file watcher.cpp.
◆ unwatch()
void fs::watcher::unwatch |
( |
std::uint64_t | key | ) |
|
|
static |
Un-watches a previously registered file or directory.
Definition at line 426 of file watcher.cpp.
◆ unwatch_all()
void fs::watcher::unwatch_all |
( |
| ) |
|
|
static |
Un-watches all previously registered file or directory.
Definition at line 431 of file watcher.cpp.
◆ unwatch_all_impl()
void fs::watcher::unwatch_all_impl |
( |
| ) |
|
|
staticprotected |
◆ unwatch_impl()
void fs::watcher::unwatch_impl |
( |
std::uint64_t | key | ) |
|
|
staticprotected |
◆ watch() [1/2]
auto fs::watcher::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 |
|
static |
Watches a file or directory for modification and call back the specified std::function. A list of modified files or directory is passed as argument of the callback. Use this version only if you are watching multiple files or a directory.
Definition at line 416 of file watcher.cpp.
◆ watch() [2/2]
static auto fs::watcher::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 |
|
static |
◆ watch_impl()
auto fs::watcher::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 |
|
staticprotected |
◆ cv_
std::condition_variable fs::watcher::cv_ |
|
protected |
◆ mutex_
std::mutex fs::watcher::mutex_ |
|
protected |
Mutex for the file watchers.
Definition at line 148 of file watcher.h.
◆ thread_
std::thread fs::watcher::thread_ |
|
protected |
Thread that polls for changes.
Definition at line 154 of file watcher.h.
◆ watchers_
std::map<std::uint64_t, std::shared_ptr<impl> > fs::watcher::watchers_ |
|
protected |
◆ watching_
std::atomic<bool> fs::watcher::watching_ = {false} |
|
protected |
The documentation for this class was generated from the following files:
- C:/Workspace/github/UnravelEngine/UnravelEngine/engine/core/filesystem/watcher.h
- C:/Workspace/github/UnravelEngine/UnravelEngine/engine/core/filesystem/watcher.cpp