uvcc
libuv C++ bindings
uv::fs_event Class Reference

FS Event handle. More...

#include "handle-fs.hpp"

Inheritance diagram for uv::fs_event:
uv::handle

Public Types

using uv_t = ::uv_fs_event_t
 
using on_fs_event_t = std::function< void(fs_event _handle, const char *_filename, int _events) >
 The function type of the FS event callback. More...
 
- Public Types inherited from uv::handle
using uv_t = ::uv_handle_t
 
using on_destroy_t = std::function< void(void *_data) >
 The function type of the callback called when the handle has been closed and about to be destroyed. More...
 

Public Member Functions

 fs_event (const fs_event &)=default
 
fs_eventoperator= (const fs_event &)=default
 
 fs_event (fs_event &&) noexcept=default
 
fs_eventoperator= (fs_event &&) noexcept=default
 
 fs_event (uv::loop &_loop, int _event_flags)
 Create an fs_event.
 
std::stringpath () const noexcept
 Set the FS path being monitored by this handle.
 
on_fs_event_ton_fs_event () const noexcept
 Set the FS event callback.
 
int start () const
 Start the handle. More...
 
template<class _Cb_ , typename... _Args_, typename = std::enable_if_t< std::is_convertible< decltype(std::bind(std::declval< _Cb_ >(), std::placeholders::_1, std::placeholders::_2, static_cast< _Args_&& >(std::declval< _Args_ >())...)), on_fs_event_t >::value >>
int start (_Cb_ &&_cb, _Args_ &&... _args) const
 Start the handle with the given callback. More...
 
template<class _Cb_ , typename... _Args_, typename = std::enable_if_t< std::is_convertible< decltype(std::bind(std::declval< _Cb_ >(), std::placeholders::_1, std::placeholders::_2, static_cast< _Args_&& >(std::declval< _Args_ >())...)), on_fs_event_t >::value >>
int start (std::string _path, _Cb_ &&_cb, _Args_ &&... _args) const
 Start the handle with the given callback, watching for the specified FS path. More...
 
int stop () const noexcept
 Stop the handle, the callback will no longer be called.
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
- Public Member Functions inherited from uv::handle
 handle (const handle &_that)
 
handleoperator= (const handle &_that)
 
 handle (handle &&_that) noexcept
 
handleoperator= (handle &&_that) noexcept
 
void swap (handle &_that) noexcept
 
std::uintptr_t id () const noexcept
 The unique ID of the instance managed by this handle variable or 0 if the handle is void.
 
long nrefs () const noexcept
 The current number of existing references to the same object as this handle variable refers to.
 
int uv_status () const noexcept
 The status value returned by the last executed libuv API function on this handle.
 
on_destroy_ton_destroy () const noexcept
 
::uv_handle_type type () const noexcept
 The tag indicating the libuv type of the handle.
 
const char * type_name () const noexcept
 A string containing the name of the handle type.
 
uv::loop loop () const noexcept
 The libuv loop where the handle is running on. More...
 
void *& data () const noexcept
 The pointer to the user-defined arbitrary data. libuv and uvcc does not use this field.
 
int is_active () const noexcept
 Check if the handle is active. More...
 
int is_closing () const noexcept
 Check if the handle is closing or closed. More...
 
::uv_os_fd_t fileno () const noexcept
 Get the platform dependent handle/file descriptor. More...
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
 operator bool () const noexcept
 Equivalent to (id() and uv_status() >= 0).
 
void attached (bool _state) const noexcept
 
bool attached () const noexcept
 

Detailed Description

FS Event handle.

See also
libuv API documentation: uv_fs_event_t — FS Event handle.

Definition at line 265 of file handle-fs.hpp.

Member Typedef Documentation

◆ on_fs_event_t

using uv::fs_event::on_fs_event_t = std::function< void(fs_event _handle, const char *_filename, int _events) >

The function type of the FS event callback.

See also
libuv API documentation: uv_fs_event_cb, uv_fs_event.

Definition at line 277 of file handle-fs.hpp.

Member Function Documentation

◆ start() [1/3]

int uv::fs_event::start ( ) const
inline

Start the handle.

Repeated call to this function results in the automatic call to stop() first.

Note
On successful start this function adds an extra reference to the handle instance, which is released when the counterpart function stop() is called.
See also
libuv API documentation: uv_fs_event_start().

Definition at line 344 of file handle-fs.hpp.

◆ start() [2/3]

template<class _Cb_ , typename... _Args_, typename = std::enable_if_t< std::is_convertible< decltype(std::bind(std::declval< _Cb_ >(), std::placeholders::_1, std::placeholders::_2, static_cast< _Args_&& >(std::declval< _Args_ >())...)), on_fs_event_t >::value >>
int uv::fs_event::start ( _Cb_ &&  _cb,
_Args_ &&...  _args 
) const
inline

Start the handle with the given callback.

This is equivalent for

fs_event.on_fs_event() = std::bind(
std::forward< _Cb_ >(_cb), std::placeholders::_1, std::placeholders::_2, std::forward< _Args_ >(_args)...
);
fs_event.start();
See also
fs_event::start()

Definition at line 390 of file handle-fs.hpp.

◆ start() [3/3]

template<class _Cb_ , typename... _Args_, typename = std::enable_if_t< std::is_convertible< decltype(std::bind(std::declval< _Cb_ >(), std::placeholders::_1, std::placeholders::_2, static_cast< _Args_&& >(std::declval< _Args_ >())...)), on_fs_event_t >::value >>
int uv::fs_event::start ( std::string  _path,
_Cb_ &&  _cb,
_Args_ &&...  _args 
) const
inline

Start the handle with the given callback, watching for the specified FS path.

This is equivalent for

fs_event.path() = _path;
fs_event.on_fs_event() = std::bind(
std::forward< _Cb_ >(_cb), std::placeholders::_1, std::placeholders::_2, std::forward< _Args_ >(_args)...
);
fs_event.start();
See also
fs_event::start()

Definition at line 412 of file handle-fs.hpp.


The documentation for this class was generated from the following file: