fswatch 1.17.1
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
30namespace fsw
31{
38 {
39 public:
49 static bool is_valid(const HANDLE & handle);
50
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 */
A RAII wrapper around Microsoft Windows HANDLE.
Definition: win_handle.hpp:38
win_handle & operator=(const win_handle &)=delete
Deleted copy assignment operator.
win_handle & operator=(const HANDLE &handle)
Assigns a handle to the current instance.
win_handle(const win_handle &)=delete
Deleted copy constructor.
win_handle & operator=(win_handle &&other) noexcept
Move assignment operator.
static bool is_valid(const HANDLE &handle)
Checks whether handle is valid.
win_handle(HANDLE handle)
Constructs an instance wrapping handle.
win_handle(win_handle &&other) noexcept
Move constructor.
win_handle()
Constructs an instance wrapping INVALID_HANDLE_VALUE.
bool is_valid() const
Checks whether the handle is valid.
virtual ~win_handle()
Destructs a handle.
Main namespace of libfswatch.
Definition: event.cpp:24