File indexing completed on 2025-03-16 08:15:00
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText:: 2022 Xaver Hugl <xaver.hugl@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include <kwin_export.h> 0012 0013 namespace KWin 0014 { 0015 0016 class KWIN_EXPORT FileDescriptor 0017 { 0018 public: 0019 FileDescriptor() = default; 0020 explicit FileDescriptor(int fd); 0021 FileDescriptor(FileDescriptor &&); 0022 FileDescriptor &operator=(FileDescriptor &&); 0023 ~FileDescriptor(); 0024 0025 bool isValid() const; 0026 int get() const; 0027 int take(); 0028 void reset(); 0029 FileDescriptor duplicate() const; 0030 0031 bool isReadable() const; 0032 bool isClosed() const; 0033 0034 static bool isReadable(int fd); 0035 static bool isClosed(int fd); 0036 0037 private: 0038 int m_fd = -1; 0039 }; 0040 0041 }