libfswatch
1.9.3
|
Event type manipulation. More...
Go to the source code of this file.
Classes | |
struct | fsw_cevent |
Typedefs | |
typedef struct fsw_cevent | fsw_cevent |
typedef void(* | FSW_CEVENT_CALLBACK) (fsw_cevent const *const events, const unsigned int event_num, void *data) |
Enumerations | |
enum | fsw_event_flag { NoOp = 0, PlatformSpecific = (1 << 0), Created = (1 << 1), Updated = (1 << 2), Removed = (1 << 3), Renamed = (1 << 4), OwnerModified = (1 << 5), AttributeModified = (1 << 6), MovedFrom = (1 << 7), MovedTo = (1 << 8), IsFile = (1 << 9), IsDir = (1 << 10), IsSymLink = (1 << 11), Link = (1 << 12), Overflow = (1 << 13) } |
Backend-agnostic change flags. More... | |
Functions | |
FSW_STATUS | fsw_get_event_flag_by_name (const char *name, enum fsw_event_flag *flag) |
Get event flag by name. More... | |
char * | fsw_get_event_flag_name (const enum fsw_event_flag flag) |
Get the name of an event flag. More... | |
Event type manipulation.
This header file defines the event types of the libfswatch
API.
typedef struct fsw_cevent fsw_cevent |
A file change event is represented as an instance of this struct where:
typedef void(* FSW_CEVENT_CALLBACK) (fsw_cevent const *const events, const unsigned int event_num, void *data) |
A function pointer of type FSW_CEVENT_CALLBACK is used by the API as a callback to provide information about received events. The callback is passed the following arguments:
The memory used by the fsw_cevent objects will be freed at the end of the callback invocation. A callback should copy such data instead of storing a pointer to it.
enum fsw_event_flag |
Backend-agnostic change flags.
Each element of this enum represents a backend-agnostic change flag. No direct mapping to backend-specific change types is guaranteed to exist: a change type may be mapped to multiple fsw_event_flag
instances included the PlatformSpecific
flag.
The values of event flags are all powers of 2, that is numbers where is an integer. This representation makes it easy to combine flags into a bit mask and encode multiple events flags into a single integer.
A monitor implementation is required to map implementation-specific flags into API flags. Sometimes, though, a perfect match is not possible and the following situation may arise:
FSW_STATUS fsw_get_event_flag_by_name | ( | const char * | name, |
enum fsw_event_flag * | flag | ||
) |
Get event flag by name.
This function looks for an event flag called name
and, if it exists, it writes its value onto flag
and FSW_OK
, otherwise flag
is not modified and FSW_ERR_UNKNOWN_VALUE
is returned.
[in] | name | The name of the event flag to look for. |
[out] | flag | The output variable where the event flag is returned. |
char* fsw_get_event_flag_name | ( | const enum fsw_event_flag | flag | ) |
Get the name of an event flag.
This function looks for the name of the specified event flag
. If it exists, it returns its name, otherwise nullptr
is returned.
[in] | flag | The event flag to look for. |
flag
, or nullptr
if it does not exist.