|
Sese Framework
3.0.0
A cross-platform framework
|
File Change Monitor. More...
#include <FileNotifier.h>
Classes | |
| class | Impl |
Public Types | |
| using | Ptr = std::unique_ptr<FileNotifier> |
| using | OnCreateCallback = std::function<void(std::string_view)> |
| using | OnMoveCallback = std::function<void(std::string_view, std::string_view)> |
| using | OnModifyCallback = std::function<void(std::string_view)> |
| using | OnDeleteCallback = std::function<void(std::string_view)> |
Public Member Functions | |
| ~FileNotifier () noexcept | |
| void | start () const noexcept |
| Start a thread to start processing the change event. | |
| void | shutdown () const noexcept |
| Shut down the monitor and block until the background thread exits. | |
| void | setOnCreate (OnCreateCallback &&callback) const noexcept |
| void | setOnMove (OnMoveCallback &&callback) const noexcept |
| void | setOnModify (OnModifyCallback &&callback) const noexcept |
| void | setOnDelete (OnDeleteCallback &&callback) const noexcept |
Static Public Member Functions | |
| static Ptr | create (const std::string &path) noexcept |
| static Result< Ptr, ErrorCode > | createEx (const std::string &path) noexcept |
Private Member Functions | |
| FileNotifier ()=default | |
Private Attributes | |
| std::unique_ptr< Impl > | impl |
File Change Monitor.
In Darwin, multiple events for the same file are triggered first, while in Windows and Linux, events are triggered in chronological order.
| using sese::system::FileNotifier::OnCreateCallback = std::function<void(std::string_view)> |
| using sese::system::FileNotifier::OnDeleteCallback = std::function<void(std::string_view)> |
| using sese::system::FileNotifier::OnModifyCallback = std::function<void(std::string_view)> |
| using sese::system::FileNotifier::OnMoveCallback = std::function<void(std::string_view, std::string_view)> |
| using sese::system::FileNotifier::Ptr = std::unique_ptr<FileNotifier> |
|
noexcept |
|
privatedefault |
|
staticnoexcept |
Create file monitor
| path | The path to the directory |
| nullptr | Creation failed |
References MAKE_UNIQUE_PRIVATE.
|
staticnoexcept |
|
noexcept |
Set the callback function to be called when a file is created
| callback | Callback function |
|
noexcept |
Set the callback function to be called when a file is deleted
| callback | Callback function |
|
noexcept |
Set the callback function to be called when a file is modified
| callback | Callback function |
|
noexcept |
Set the callback function to be called when a file is moved
| callback | Callback function |
|
noexcept |
Shut down the monitor and block until the background thread exits.
References impl.
|
noexcept |
Start a thread to start processing the change event.
References impl.
|
private |
Referenced by sese::system::FileNotifier::Impl::create(), shutdown(), and start().