libfswatch  1.9.3
win_handle.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_WINDOWS_HANDLE_H
26 # define FSW_WINDOWS_HANDLE_H
27 
28 # include <windows.h>
29 
30 namespace fsw
31 {
37  class win_handle
38  {
39  public:
49  static bool is_valid(const HANDLE & handle);
50 
54  win_handle();
55 
59  win_handle(HANDLE handle);
60 
69  virtual ~win_handle();
70 
74  operator HANDLE() const;
75 
82  bool is_valid() const;
83 
87  win_handle(const win_handle&) = delete;
88 
92  win_handle& operator=(const win_handle&) = delete;
93 
104  win_handle(win_handle&& other) noexcept;
105 
116  win_handle& operator=(win_handle&& other) noexcept;
117 
126  win_handle& operator=(const HANDLE& handle);
127  private:
128  HANDLE h;
129  };
130 }
131 
132 #endif /* FSW_WINDOWS_HANDLE_H */
Main namespace of libfswatch.
Definition: event.cpp:23
win_handle()
Constructs an instance wrapping INVALID_HANDLE_VALUE.
virtual ~win_handle()
Destructs a handle.
A RAII wrapper around Microsoft Windows HANDLE.
Definition: win_handle.hpp:37
win_handle & operator=(const win_handle &)=delete
Deleted copy assignment operator.
bool is_valid() const
Checks whether the handle is valid.