Unravel Engine C++ Reference
Loading...
Searching...
No Matches
fs::watcher Class Reference

#include <watcher.h>

Classes

struct  entry
 

Public Types

enum  entry_status {
  created , modified , removed , renamed ,
  unmodified
}
 
using notify_callback = std::function<void(const std::vector<entry>&, bool)>
 
using clock_t = std::chrono::steady_clock
 

Static Public Member Functions

static auto watch (const fs::path &path, const pattern_filter &filter, bool recursive, bool initial_list, clock_t::duration poll_interval, notify_callback callback, const std::string &watcher_name="") -> 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 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 ()
 Pauses all watchers.
 
static void resume ()
 Resumes all watchers.
 

Detailed Description

Definition at line 18 of file watcher.h.

Member Typedef Documentation

◆ clock_t

using fs::watcher::clock_t = std::chrono::steady_clock

Definition at line 42 of file watcher.h.

◆ notify_callback

using fs::watcher::notify_callback = std::function<void(const std::vector<entry>&, bool)>

Definition at line 41 of file watcher.h.

Member Enumeration Documentation

◆ entry_status

Enumerator
created 
modified 
removed 
renamed 
unmodified 

Definition at line 21 of file watcher.h.

Member Function Documentation

◆ pause()

void fs::watcher::pause ( )
static

Pauses all watchers.

Definition at line 87 of file watcher.cpp.

◆ resume()

void fs::watcher::resume ( )
static

Resumes all watchers.

Definition at line 93 of file watcher.cpp.

◆ 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 57 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 45 of file watcher.cpp.

◆ unwatch_all()

void fs::watcher::unwatch_all ( )
static

Un-watches all previously registered file or directory.

Definition at line 51 of file watcher.cpp.

◆ watch()

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,
const std::string & watcher_name = "" ) -> 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 27 of file watcher.cpp.


The documentation for this class was generated from the following files: