Qore fsevent Module
..
|
Implementation of filesystem event watcher. More...
Public Member Methods | |
int | addPath (string path, bool recursive=False) |
Add new path for monitoring. More... | |
constructor () | |
Create an empty file system watcher. No directories are monitored. | |
copy () | |
Copy method - instance of this class cannot be copied. More... | |
destructor () | |
stops the watcher thread and destroyes the object | |
*list< string > | directories () |
Return all monitored directories. More... | |
abstract | event (hash< FsEventInfo > event) |
Filesystem event handler/callback. More... | |
removePath (int id) | |
Remove a directory tree from monitoring by its id. More... | |
removePath (string path) | |
Remove a directory tree from monitoring by its name. More... | |
Implementation of filesystem event watcher.
This is an abstract class. Developers have to inherit AbstractFsWatcher with method event() implemented.
Basic Example
int Qore::FsEvents::AbstractFsWatcher::addPath | ( | string | path, |
bool | recursive = False |
||
) |
Add new path for monitoring.
path | a string with path to be monitored |
recursive | False = only the top level directory is monitored; True = all sub-directories are monitored too |
The returning id can be used in AbstractFsWatcher::removePath()
Qore::FsEvents::AbstractFsWatcher::copy | ( | ) |
Copy method - instance of this class cannot be copied.
FSWATCHER-COPY-ERROR | - Copying of AbstractFsWatcher objects is not supported |
*list<string> Qore::FsEvents::AbstractFsWatcher::directories | ( | ) |
Return all monitored directories.
|
pure virtual |
Filesystem event handler/callback.
event | the filesystem event hash |
Qore::FsEvents::AbstractFsWatcher::removePath | ( | int | id | ) |
Remove a directory tree from monitoring by its id.
id | an integer value. Obtained by AbstractFsWatcher::addPath |
This method uses a map lookup: O(ln(n))
Qore::FsEvents::AbstractFsWatcher::removePath | ( | string | path | ) |
Remove a directory tree from monitoring by its name.
path | a named path to remove |
This method uses a linear search: O(n)