uvw  2.11.0
fs_poll.h
1 #ifndef UVW_FS_POLL_INCLUDE_H
2 #define UVW_FS_POLL_INCLUDE_H
3 
4 
5 #include <string>
6 #include <chrono>
7 #include <uv.h>
8 #include "handle.hpp"
9 #include "util.h"
10 #include "loop.h"
11 
12 
13 namespace uvw {
14 
15 
21 struct FsPollEvent {
22  explicit FsPollEvent(Stat previous, Stat current) noexcept;
23 
26 };
27 
28 
38 class FsPollHandle final: public Handle<FsPollHandle, uv_fs_poll_t> {
39  static void startCallback(uv_fs_poll_t *handle, int status, const uv_stat_t *prev, const uv_stat_t *curr);
40 
41 public:
42  using Time = std::chrono::duration<unsigned int, std::milli>;
43 
44  using Handle::Handle;
45 
50  bool init();
51 
60  void start(const std::string &file, Time interval);
61 
65  void stop();
66 
72  std::string path() noexcept;
73 };
74 
75 
76 }
77 
78 
79 #ifndef UVW_AS_LIB
80 #include "fs_poll.cpp"
81 #endif
82 
83 
84 #endif // UVW_FS_POLL_INCLUDE_H
The FsPollHandle handle.
Definition: fs_poll.h:38
bool init()
Initializes the handle.
std::string path() noexcept
Gets the path being monitored by the handle.
void start(const std::string &file, Time interval)
Starts the handle.
void stop()
Stops the handle.
Handle base class.
Definition: handle.hpp:30
uvw default namespace.
Definition: async.h:10
uv_stat_t Stat
Definition: util.h:199
FsPollEvent event.
Definition: fs_poll.h:21