7 #ifndef _FCITX_UTILS_UNIXFD_H_ 8 #define _FCITX_UTILS_UNIXFD_H_ 15 #include <fcitx-utils/fcitxutils_export.h> 17 #include <fcitx-utils/macros.h> 36 explicit UnixFD(
int fd,
int min);
38 FCITX_DECLARE_MOVE(
UnixFD);
49 bool isValid()
const noexcept;
65 void set(
int fd,
int min);
68 void reset() noexcept;
71 int release() noexcept;
74 int fd()
const noexcept;
77 void give(
int fd) noexcept;
85 builder <<
"UnixFD(fd=" << fd.
fd() <<
")";
90 #endif // _FCITX_UTILS_UNIXFD_H_ Class wrap around the unix fd.
int fd() const noexcept
Get the internal fd.
static UnixFD own(int fd)
Create a UnixFD by owning the fd.
void give(int fd) noexcept
Set a new FD and transfer the ownership to UnixFD.