libfswatch  1.9.3
win_directory_change_event.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Enrico M. Crisostomo
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 3, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program. If not, see <http://www.gnu.org/licenses/>.
15  */
25 #ifndef FSW_WIN_DIRECTORY_CHANGE_EVENT_H
26 # define FSW_WIN_DIRECTORY_CHANGE_EVENT_H
27 
28 # include <cstdlib>
29 # include <string>
30 # include <memory>
31 # include <vector>
32 # include <windows.h>
33 # include "win_handle.hpp"
34 # include "win_error_message.hpp"
35 # include "../event.hpp"
36 
37 namespace fsw
38 {
45  {
46  public:
47  std::wstring path;
48  win_handle handle;
49  size_t buffer_size;
50  DWORD bytes_returned;
51  std::unique_ptr<void, decltype(free)*> buffer = {nullptr, free};
52  std::unique_ptr<OVERLAPPED, decltype(free)*> overlapped = {static_cast<OVERLAPPED *> (malloc(sizeof (OVERLAPPED))), free};
53  win_error_message read_error;
54 
55  directory_change_event(size_t buffer_length = 16);
56  bool is_io_incomplete();
57  bool is_buffer_overflowed();
58  bool read_changes_async();
59  bool try_read();
60  void continue_read();
61  std::vector<event> get_events();
62  };
63 }
64 
65 #endif /* WIN_DIRECTORY_CHANGE_EVENT_H */
66 
Main namespace of libfswatch.
Definition: event.cpp:23
Header of the fsw::win_handle class.
Header of the fsw::directory_change_event class, a helper class to wrap Microsoft Windows' ReadDirect...
Definition: win_directory_change_event.hpp:44
Header of the fsw::win_error_message class.
A RAII wrapper around Microsoft Windows HANDLE.
Definition: win_handle.hpp:37
Helper class to get the system-defined error message for a Microsoft Windows' error code...
Definition: win_error_message.hpp:41