57 ENABLE_DEFAULT_COPY_AND_MOVE_NOEXCEPT(
BorrowedFd);
61 bool operator==(
BorrowedFd const & fd) const noexcept {
return _fd == fd._fd; }
62 bool operator==(
int fd)
const noexcept {
return _fd == fd; }
67 int get() const noexcept {
return _fd; }
70 bool isValid() const noexcept {
return _fd != -1; }
74 void reset() noexcept { _fd = -1; }
80inline void swap(BorrowedFd & fd1, BorrowedFd & fd2)
noexcept { fd1.swap(fd2); }
84struct std::formatter<
dfx::FdWatch::BorrowedFd> :
public formatter<int>
87 {
return formatter<int>::format(e.
get(), ctx); }
91struct std::hash<
dfx::FdWatch::BorrowedFd>
94 {
return static_cast<std::size_t
>(fd.
get()); }
Convenience macros to explicitly control copy and move semantics.
Non-owning wrapper around a file descriptor.
Definition BorrowedFd.hpp:37
BorrowedFd() noexcept=default
Create an invalid BorrowedFd.
bool isValid() const noexcept
Check if the current BorrowedFd contains a valid fd.
Definition BorrowedFd.hpp:70
void reset() noexcept
Invalidate this BorrowedFd.
Definition BorrowedFd.hpp:74
int get() const noexcept
Get the underlying file descriptor value.
Definition BorrowedFd.hpp:67
Owning RAII wrapper around a file descriptor.
Definition OwnedFd.hpp:36
RAII wrapper for the registration of a FD in a Poller.
Definition PollerFd.hpp:42
Definition SocketClient.hpp:23
Definition Message.hpp:21