KWin
Loading...
Searching...
No Matches
filedescriptor.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText:: 2022 Xaver Hugl <xaver.hugl@gmail.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10
11#include <kwin_export.h>
12
13namespace KWin
14{
15
16class KWIN_EXPORT FileDescriptor
17{
18public:
19 FileDescriptor() = default;
20 explicit FileDescriptor(int fd);
22 FileDescriptor &operator=(FileDescriptor &&);
24
25 bool isValid() const;
26 int get() const;
27 int take();
28 void reset();
29 FileDescriptor duplicate() const;
30
31 bool isReadable() const;
32 bool isClosed() const;
33
34 static bool isReadable(int fd);
35 static bool isClosed(int fd);
36
37private:
38 int m_fd = -1;
39};
40
41}
FileDescriptor()=default