dot-xx
A personal collection of small C++ modules
Loading...
Searching...
No Matches
dxx::utils::FileDescriptor Class Referenceexport
module dxx.utils

RAII file descriptor. Wraps an integer file descriptor and defers closing it to the desctructor. More...

Public Member Functions

 FileDescriptor (int c_fd)
 Wrap a file descriptor integer.
 FileDescriptor (const FileDescriptor &)=delete
FileDescriptoroperator= (const FileDescriptor &)=delete
 FileDescriptor (FileDescriptor &&other)
 Take ownership of another file descriptor.
FileDescriptoroperator= (FileDescriptor &&other)
 Take ownership of another file descriptor and close already owned if any.
 ~FileDescriptor ()
 Close the file descriptor if opened.
int operator* () const
 Get the underlying descriptor. Sorry for implicit conversion, I just wanted it to be a drop-in replacement.
int get () const
 Get the underlying descriptor.

Detailed Description

RAII file descriptor. Wraps an integer file descriptor and defers closing it to the desctructor.

Constructor & Destructor Documentation

◆ FileDescriptor()

dxx::utils::FileDescriptor::FileDescriptor ( int c_fd)
inline

Wrap a file descriptor integer.

If -1 is passed, it will no be closed


The documentation for this class was generated from the following file:
  • /build-llvm-libcpp/_deps/dot-xx-utils-src/src/file_descriptor.xx