fawkes::FileAlterationMonitor Class Reference
#include <fam.h>
List of all members.
Detailed Description
Monitors files for changes. This is a wrapper around inotify. It will watch directories and files for modifications. If a modifiacation, removal or addition of a file is detected one or more listeners are called. The files which trigger the event can be constrained with regular expressions.
- Author:
- Tim Niemueller
Definition at line 70 of file fam.h.
Constructor & Destructor Documentation
fawkes::FileAlterationMonitor::FileAlterationMonitor |
( |
|
) |
|
Constructor. Opens the inotify context.
Definition at line 121 of file fam.cpp.
fawkes::FileAlterationMonitor::~FileAlterationMonitor |
( |
|
) |
|
Destructor.
Definition at line 141 of file fam.cpp.
Member Function Documentation
void fawkes::FileAlterationMonitor::add_filter |
( |
const char * |
regex |
) |
|
Add a filter. Filters are applied to path names that triggered an event. All pathnames are checked against this regex and if any does not match the event is not posted to listeners. An example regular expression is
This regular expression matches to all files that does not start with a dot and have an .lua ending.
- Parameters:
-
| regex | regular expression to add |
Definition at line 244 of file fam.cpp.
void fawkes::FileAlterationMonitor::add_listener |
( |
FamListener * |
listener |
) |
|
Add a listener.
- Parameters:
-
Definition at line 262 of file fam.cpp.
void fawkes::FileAlterationMonitor::interrupt |
( |
|
) |
|
void fawkes::FileAlterationMonitor::process_events |
( |
int |
timeout = 0 |
) |
|
Process events. Call this when you want file events to be processed.
- Parameters:
-
| timeout | timeout in milliseconds to wait for an event, 0 to just check and no wait, -1 to wait forever until an event is received |
Definition at line 284 of file fam.cpp.
void fawkes::FileAlterationMonitor::remove_listener |
( |
FamListener * |
listener |
) |
|
Remove a listener.
- Parameters:
-
| listener | listener to remove |
Definition at line 272 of file fam.cpp.
void fawkes::FileAlterationMonitor::watch_dir |
( |
const char * |
dirpath |
) |
|
Watch a directory. This adds the given directory recursively to this FAM.
- Parameters:
-
| dirpath | path to directory to add |
Definition at line 166 of file fam.cpp.
void fawkes::FileAlterationMonitor::watch_file |
( |
const char * |
filepath |
) |
|
Watch a file. This adds the given fileto this FAM.
- Parameters:
-
| filepath | path to file to add |
Definition at line 215 of file fam.cpp.
Member Data Documentation
Definition at line 93 of file fam.h.
Definition at line 94 of file fam.h.
Definition at line 92 of file fam.h.
Definition at line 95 of file fam.h.
Definition at line 96 of file fam.h.
Definition at line 98 of file fam.h.
Definition at line 99 of file fam.h.
Definition at line 87 of file fam.h.
Definition at line 88 of file fam.h.
Definition at line 89 of file fam.h.
Definition at line 90 of file fam.h.
The documentation for this class was generated from the following files: