Branch data Line data Source code
1 : : #pragma once 2 : : 3 : : namespace Linux 4 : : { 5 : : 6 : : class FileDescriptor 7 : : { 8 : : public: 9 : 2 : FileDescriptor() = default; 10 : : 11 : : FileDescriptor(FileDescriptor const&) = delete; 12 : : 13 : : FileDescriptor(FileDescriptor&& other) noexcept; 14 : : 15 : : auto operator=(FileDescriptor const&) -> FileDescriptor& = delete; 16 : : 17 : : auto operator=(FileDescriptor&& other) noexcept -> FileDescriptor&; 18 : : 19 : : ~FileDescriptor(); 20 : : 21 : : explicit FileDescriptor(int handle); 22 : : 23 : : auto GetNativeHandle() const noexcept -> int; 24 : : 25 : : auto CheckNativeHandle() const noexcept -> bool; 26 : : 27 : : [[nodiscard]] 28 : : #if defined(__clang__) 29 : : [[clang::reinitializes]] 30 : : #endif 31 : : auto ReleaseNativeHandle() noexcept -> int; 32 : : 33 : : private: 34 : : int handle_ = -1; 35 : : }; 36 : : 37 : : } // namespace Linux