uvw 2.12.1
Loading...
Searching...
No Matches
uvw::FsEventHandle Class Referencefinal

The FsEventHandle handle. More...

#include <fs_event.h>

Inheritance diagram for uvw::FsEventHandle:
Collaboration diagram for uvw::FsEventHandle:

Public Member Functions

bool init ()
 Initializes the handle.
 
void start (const std::string &path, Flags< Event > flags=Flags< Event >{})
 Starts watching the specified path.
 
void start (const std::string &path, Event flag)
 Starts watching the specified path.
 
void stop ()
 Stops polling the file descriptor.
 
std::string path () noexcept
 Gets the path being monitored.
 
- Public Member Functions inherited from uvw::Handle< FsEventHandle, uv_fs_event_t >
HandleCategory category () const noexcept
 Gets the category of the handle.
 
HandleType 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 sendBufferSize ()
 Gets the size of the send buffer used for the socket.
 
bool sendBufferSize (int value)
 Sets the size of the send buffer used for the socket.
 
int recvBufferSize ()
 Gets the size of the receive buffer used for the socket.
 
bool recvBufferSize (int value)
 Sets the size of the receive buffer used for the socket.
 
OSFileDescriptor fd () const
 Gets the platform dependent file descriptor equivalent.
 
- Public Member Functions inherited from uvw::Resource< FsEventHandle, uv_fs_event_t >
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::UnderlyingType< FsEventHandle, uv_fs_event_t >
Looploop () const noexcept
 Gets the loop from which the resource was originated.
 
const uv_fs_event_t * raw () const noexcept
 Gets the underlying raw data structure.
 
uv_fs_event_t * raw () noexcept
 Gets the underlying raw data structure.
 
- Public Member Functions inherited from uvw::Emitter< FsEventHandle >
Connection< E > on (Listener< E > f)
 Registers a long-lived listener with the event emitter.
 
Connection< E > once (Listener< E > f)
 Registers a short-lived listener with the event emitter.
 
void erase (Connection< E > conn) noexcept
 Disconnects a listener from the event emitter.
 
void clear () noexcept
 Disconnects all the listeners for the given event type.
 
void clear () noexcept
 Disconnects all the listeners.
 
bool empty () const noexcept
 Checks if there are listeners registered for the specific event.
 
bool empty () const noexcept
 Checks if there are listeners registered with the event emitter.
 

Additional Inherited Members

- Public Types inherited from uvw::Emitter< FsEventHandle >
- Static Public Member Functions inherited from uvw::UnderlyingType< FsEventHandle, uv_fs_event_t >
static std::shared_ptr< FsEventHandlecreate (Args &&...args)
 Creates a new resource of the given type.
 
- Protected Types inherited from uvw::Resource< FsEventHandle, uv_fs_event_t >
- Protected Member Functions inherited from uvw::Handle< FsEventHandle, uv_fs_event_t >
- Protected Member Functions inherited from uvw::Resource< FsEventHandle, uv_fs_event_t >
- Protected Member Functions inherited from uvw::UnderlyingType< FsEventHandle, uv_fs_event_t >
- Protected Member Functions inherited from uvw::Emitter< FsEventHandle >
- Static Protected Member Functions inherited from uvw::Handle< FsEventHandle, uv_fs_event_t >

Detailed Description

The FsEventHandle 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 FsEventHandle through a Loop, no arguments are required.

See the official documentation for further details.

Definition at line 68 of file fs_event.h.

Member Function Documentation

◆ init()

bool uvw::FsEventHandle::init ( )

Initializes the handle.

Returns
True in case of success, false otherwise.

◆ path()

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

Gets the path being monitored.

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

◆ start() [1/2]

void uvw::FsEventHandle::start ( const std::string & path,
Event flag )

Starts watching the specified path.

It will watch the specified path for changes.
As soon as a change is observed, a FsEventEvent is emitted by the handle.
It could happen that ErrorEvent events are emitted while running.

Available flags are:

  • FsEventHandle::Event::WATCH_ENTRY
  • FsEventHandle::Event::STAT
  • FsEventHandle::Event::RECURSIVE
Parameters
pathThe file or directory to be monitored.
flagAdditional flag to control the behavior.

◆ start() [2/2]

void uvw::FsEventHandle::start ( const std::string & path,
Flags< Event > flags = Flags< Event >{} )

Starts watching the specified path.

It will watch the specified path for changes.
As soon as a change is observed, a FsEventEvent is emitted by the handle.
It could happen that ErrorEvent events are emitted while running.

Available flags are:

  • FsEventHandle::Event::WATCH_ENTRY
  • FsEventHandle::Event::STAT
  • FsEventHandle::Event::RECURSIVE
Parameters
pathThe file or directory to be monitored.
flagsAdditional flags to control the behavior.

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