lfilesystem
0.0.1
C++ filesystem library
|
This class implements all of FileWatcher's
virtual methods, and allows you to easily specify a lambda function that will be called for any event type.
More...
#include <lfilesystem_SimpleWatcher.h>
Public Types | |
using | Callback = std::function< void(const FilesystemEntry &)> |
The type of the lambda that will be called for any event type. More... | |
Public Member Functions | |
SimpleFileWatcher (const FilesystemEntry &fileToWatch, Callback &&callbackToUse) | |
Creates a file watcher that will call the given callback for every event type on the watched path. More... | |
Public Member Functions inherited from limes::files::FileWatcher | |
FileWatcher () noexcept | |
Creates an inactive FileWatcher that does nothing. More... | |
FileWatcher (const FilesystemEntry &fileToWatch) | |
Creates a FileWatcher to watch the given file or directory. More... | |
FileWatcher (const FileWatcher &)=delete | |
FileWatcher (FileWatcher &&)=delete | |
virtual | ~FileWatcher () |
Destructor. More... | |
FilesystemEntry | getWatchedPath () const noexcept |
Returns the path that is currently being watched. More... | |
bool | isRunning () |
Returns true if the FilesystemWatcher is currently monitoring events. More... | |
FileWatcher & | operator= (const FileWatcher &)=delete |
FileWatcher & | operator= (FileWatcher &&)=delete |
bool | start () |
Restarts watching the path specified at construction. More... | |
bool | start (const FilesystemEntry &newPathToWatch) |
Begins watching the new specified path. More... | |
void | stop () |
Stops the FilesystemWatcher's event callbacks. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from limes::files::FileWatcher | |
static bool | supportedBySystem () noexcept |
Returns true if the current system supports file event watching. More... | |
This class implements all of FileWatcher's
virtual methods, and allows you to easily specify a lambda function that will be called for any event type.
Definition at line 37 of file lfilesystem_SimpleWatcher.h.
using limes::files::SimpleFileWatcher::Callback = std::function<void (const FilesystemEntry&)> |
The type of the lambda that will be called for any event type.
The argument is the file that was affected by the action, so if a directory is being watched, this may be a child path of the watched directory.
Definition at line 46 of file lfilesystem_SimpleWatcher.h.
|
explicit |
Creates a file watcher that will call the given callback
for every event type on the watched path.
std::runtime_error | Throws an exception if the file watcher fails to initialize for any reason. An exception will always be thrown if the file you request to watch does not exist at the time of the object's construction. |