uvw 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
uvw::fs_event_handle Class Referencefinal

The fs event handle. More...

#include <fs_event.h>

Inheritance diagram for uvw::fs_event_handle:
Inheritance graph
[legend]
Collaboration diagram for uvw::fs_event_handle:
Collaboration graph
[legend]

Public Member Functions

int init () final
 Initializes the handle.
 
int start (const std::string &path, event_flags flags=event_flags::_UVW_ENUM)
 Starts watching the specified path.
 
int stop ()
 Stops polling the file descriptor.
 
std::string path () noexcept
 Gets the path being monitored.
 
- Public Member Functions inherited from uvw::handle< fs_event_handle, uv_fs_event_t, fs_event_event >
handle_category category () const noexcept
 Gets the category of the handle.
 
handle_type type () const noexcept
 Gets the type of the handle.
 
bool active () const noexcept
 Checks if the handle is active.
 
bool closing () const noexcept
 Checks if a handle is closing or closed.
 
void close () noexcept
 Request handle to be closed.
 
void reference () noexcept
 Reference the given handle.
 
void unreference () noexcept
 Unreference the given handle.
 
bool referenced () const noexcept
 Checks if the given handle referenced.
 
std::size_t size () const noexcept
 Returns the size of the underlying handle type.
 
int send_buffer_size ()
 Gets the size of the send buffer used for the socket.
 
int send_buffer_size (int value)
 Sets the size of the send buffer used for the socket.
 
int recv_buffer_size ()
 Gets the size of the receive buffer used for the socket.
 
int recv_buffer_size (int value)
 Sets the size of the receive buffer used for the socket.
 
os_file_descriptor fd () const
 Gets the platform dependent file descriptor equivalent.
 
- Public Member Functions inherited from uvw::resource< T, U, E >
template<typename R = void>
std::shared_ptr< R > data () const
 Gets user-defined data. uvw won't use this field in any case.
 
void data (std::shared_ptr< void > udata)
 Sets arbitrary data. uvw won't use this field in any case.
 
- Public Member Functions inherited from uvw::uv_type< U >
virtual int init ()
 Initializes the handle.
 
loopparent () const noexcept
 Gets the loop from which the resource was originated.
 
const U * raw () const noexcept
 Gets the underlying raw data structure.
 
U * raw () noexcept
 Gets the underlying raw data structure.
 
- Public Member Functions inherited from uvw::emitter< T, E... >
void on (listener_t< U > f)
 Registers a long-lived listener with the event emitter.
 
void reset () noexcept
 Disconnects the listener for the given event type.
 
void reset () noexcept
 Disconnects all listeners.
 
bool has () const noexcept
 Checks if there is a listener registered for the specific event.
 

Detailed Description

The fs event handle.

These handles allow the user to monitor a given path for changes, for example, if the file was renamed or there was a generic change in it. The best backend for the job on each platform is chosen by the handle.

To create a fs_event_handle through a loop, no arguments are required.

See the official documentation for further details.

Definition at line 67 of file fs_event.h.

Member Function Documentation

◆ init()

int uvw::fs_event_handle::init ( )
finalvirtual

Initializes the handle.

Returns
Underlying return value.

Reimplemented from uvw::uv_type< U >.

◆ path()

std::string uvw::fs_event_handle::path ( )
noexcept

Gets the path being monitored.

Returns
The path being monitored, an empty string in case of errors.

◆ start()

int uvw::fs_event_handle::start ( const std::string &  path,
event_flags  flags = event_flags::_UVW_ENUM 
)

Starts watching the specified path.

It will watch the specified path for changes.
As soon as a change is observed, a fs_event_event is emitted by the handle.

Available flags are:

  • fs_event_handle::event_flags::WATCH_ENTRY
  • fs_event_handle::event_flags::STAT
  • fs_event_handle::event_flags::RECURSIVE
Parameters
pathThe file or directory to be monitored.
flagsAdditional flags to control the behavior.
Returns
Underlying return value.

◆ stop()

int uvw::fs_event_handle::stop ( )

Stops polling the file descriptor.

Returns
Underlying return value.

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