libfswatch  1.9.3
Namespaces | Classes | Typedefs | Functions | Variables
fsw Namespace Reference

Main namespace of libfswatch. More...

Namespaces

 string_utils
 This namespace contains string manipulation functions.
 
 win_paths
 Path conversion functions.
 
 win_strings
 String conversion functions.
 

Classes

struct  compiled_monitor_filter
 
class  directory_change_event
 Header of the fsw::directory_change_event class, a helper class to wrap Microsoft Windows' ReadDirectoryChangesW function and a common workflow to detect file system changes. More...
 
class  event
 Type representing a file change event. More...
 
class  fen_monitor
 Solaris/Illumos monitor. More...
 
struct  FSEventFlagType
 
class  fsevents_monitor
 OS X FSEvents monitor. More...
 
class  inotify_monitor
 Solaris/Illumos monitor. More...
 
struct  inotify_monitor_impl
 
class  kqueue_monitor
 Solaris/Illumos monitor. More...
 
class  libfsw_exception
 Base exception of the libfswatch library. More...
 
class  monitor
 Base class of all monitors. More...
 
class  monitor_factory
 Object factory class for fsw::monitor instances. More...
 
struct  monitor_filter
 Path filters used to accept or reject file change events. More...
 
class  monitor_registrant
 Helper class to register monitor factories. More...
 
class  poll_monitor
 stat()-based monitor. More...
 
class  win_error_message
 Helper class to get the system-defined error message for a Microsoft Windows' error code. More...
 
struct  win_flag_type
 
class  win_handle
 A RAII wrapper around Microsoft Windows HANDLE. More...
 
class  windows_monitor
 Windows monitor. More...
 

Typedefs

typedef struct fsw::monitor_filter monitor_filter
 Path filters used to accept or reject file change events. More...
 
typedef struct fsw::FSEventFlagType FSEventFlagType
 
template<typename K , typename V >
using fsw_hash_map = std::map< K, V >
 Default associative container type used by libfswatch. More...
 
template<typename K >
using fsw_hash_set = std::set< K >
 Default set type used by libfswatch. More...
 
typedef void FSW_EVENT_CALLBACK(const std::vector< event > &, void *)
 Function definition of an event callback. More...
 
typedef monitor *(* FSW_FN_MONITOR_CREATOR) (std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context)
 
typedef struct fsw::poll_monitor::poll_monitor_data poll_monitor_data
 

Functions

ostream & operator<< (ostream &out, const fsw_event_flag flag)
 
std::ostream & operator<< (std::ostream &out, const fsw_event_flag flag)
 Overload of the << operator to print an event using iostreams. More...
 
static vector< FSEventFlagTypecreate_flag_type_vector ()
 
 REGISTER_MONITOR_IMPL (fsevents_monitor, fsevents_monitor_type)
 
static vector< fsw_event_flagdecode_flags (FSEventStreamEventFlags flag)
 
 REGISTER_MONITOR_IMPL (inotify_monitor, inotify_monitor_type)
 
static monitorcreate_default_monitor (vector< string > paths, FSW_EVENT_CALLBACK *callback, void *context)
 
vector< string > get_directory_children (const string &path)
 
bool read_link_path (const string &path, string &link_path)
 
bool stat_path (const string &path, struct stat &fd_stat)
 
bool lstat_path (const string &path, struct stat &fd_stat)
 
std::vector< std::string > get_directory_children (const std::string &path)
 Gets a vector of direct directory children. More...
 
bool read_link_path (const std::string &path, std::string &link_path)
 Resolves a path name. More...
 
bool lstat_path (const std::string &path, struct stat &fd_stat)
 Wraps a lstat(path, fd_stat) call that invokes perror() if it fails. More...
 
bool stat_path (const std::string &path, struct stat &fd_stat)
 Wraps a stat(path, fd_stat) call that invokes perror() if it fails. More...
 
 REGISTER_MONITOR_IMPL (poll_monitor, poll_monitor_type)
 
static vector< win_flag_typecreate_flag_type_vector ()
 
static vector< fsw_event_flagdecode_flags (DWORD flag)
 

Variables

static const vector< FSEventFlagTypeevent_flag_type = create_flag_type_vector()
 
static const unsigned int BUFFER_SIZE = (10 * ((sizeof(struct inotify_event)) + NAME_MAX + 1))
 
static const vector< win_flag_typeevent_flag_type = create_flag_type_vector()
 

Detailed Description

Main namespace of libfswatch.

Typedef Documentation

typedef void fsw::FSW_EVENT_CALLBACK(const std::vector< event > &, void *)

Function definition of an event callback.

The event callback is a user-supplied function that is invoked by the monitor when an event is detected. The following parameters are passed to the callback:

  • A reference to the vector of events.
  • A pointer to the context data set by the caller.
template<typename K , typename V >
using fsw::fsw_hash_map = typedef std::map<K, V>

Default associative container type used by libfswatch.

This type definition will be a synonym of std::unordered_map if the C++ library contains it, otherwise it will default to std::map.

template<typename K >
using fsw::fsw_hash_set = typedef std::set<K>

Default set type used by libfswatch.

This type definition will be a synonym of std::unordered_set if the C++ library contains it, otherwise it will default to std::set.

Path filters used to accept or reject file change events.

A path filter is a regular expression used to accept or reject file change events based on the value of their path. A filter has the following characteristics:

Further information about how filtering works in libfswatch can be found in Path Filtering.

Function Documentation

std::vector<std::string> fsw::get_directory_children ( const std::string &  path)

Gets a vector of direct directory children.

Parameters
pathThe directory whose children must be returned.
Returns
A vector containing the list of children of path.
bool fsw::lstat_path ( const std::string &  path,
struct stat &  fd_stat 
)

Wraps a lstat(path, fd_stat) call that invokes perror() if it fails.

Parameters
pathThe path to lstat().
fd_statThe stat structure where lstat() writes its results.
Returns
true if the function succeeds, false otherwise.
std::ostream& fsw::operator<< ( std::ostream &  out,
const fsw_event_flag  flag 
)

Overload of the << operator to print an event using iostreams.

Parameters
outA reference to the output stream.
flagThe flag to print.
Returns
A reference to the stream.
bool fsw::read_link_path ( const std::string &  path,
std::string &  link_path 
)

Resolves a path name.

This function resolves path using realpath() and stores the absolute pathname into link_path. The function returns true if it succeeds, false otherwise.

Parameters
pathThe path to resolve.
link_pathA reference to a std::string where the resolved absolute path should be copied to.
Returns
true if the function succeeds, false otherwise.
bool fsw::stat_path ( const std::string &  path,
struct stat &  fd_stat 
)

Wraps a stat(path, fd_stat) call that invokes perror() if it fails.

Parameters
pathThe path to stat().
fd_statThe stat structure where stat() writes its results.
Returns
true if the function succeeds, false otherwise.