|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
文件系统监视器 更多...
#include <file_watcher.hpp>
Public 成员函数 | |
| file_watcher (path watch_path, bool recursive=false) | |
| 构造函数 | |
| ~file_watcher () | |
| 析构函数 | |
| bool | start (callback_t callback, file_watch_event events=file_watch_event::ALL) |
| 开始监视 | |
| void | stop () |
| 停止监视 | |
| NEFORCE_NODISCARD const path & | watch_path () const noexcept |
| 获取监视的目录路径 | |
| NEFORCE_NODISCARD file_watch_event | current_events () const noexcept |
| 获取当前监视的事件类型 | |
| NEFORCE_NODISCARD bool | is_watching () const noexcept |
| 检查是否正在监视 | |
| NEFORCE_NODISCARD bool | is_recursive () const noexcept |
| 检查是否递归监视子目录 | |
| bool | update_watch (file_watch_event events) |
| 更新监视的事件类型 | |
| bool | update_recursive (bool recursive) |
| 更新递归设置 | |
|
explicit |
构造函数
| watch_path | 要监视的目录路径 |
| recursive | 是否递归监视子目录 |
| system_exception | 路径不存在或不是目录时抛出 |
引用了 watch_path().
被这些函数引用 ~file_watcher().
| file_watcher::~file_watcher | ( | ) |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| bool file_watcher::start | ( | callback_t | callback, |
| file_watch_event | events = file_watch_event::ALL ) |
开始监视
| callback | 事件回调函数 |
| events | 要监视的事件类型 |
启动一个后台线程开始监视文件系统事件。 当指定的事件发生时,回调函数会被调用,参数为文件路径和事件类型。
引用了 ALL.
| void file_watcher::stop | ( | ) |
停止监视
停止监视线程并清理相关资源。
| bool file_watcher::update_recursive | ( | bool | recursive | ) |
更新递归设置
| recursive | 新的递归设置 |
如果正在监视中,会重启监视器以应用新的递归设置。
| bool file_watcher::update_watch | ( | file_watch_event | events | ) |
更新监视的事件类型
| events | 新的事件类型 |
如果正在监视中,会重启监视器以应用新的事件类型。
|
inlinenoexcept |