xentara-utils v2.0.3
The Xentara Utility Library
|
A Posix file descriptor that closes itself on destruct. More...
#include <xentara/utils/posix/File.hpp>
Public Types | |
using | NativeType = int |
A native Posix file descriptor. | |
Public Member Functions | |
constexpr | File () noexcept=default |
Default constructor. | |
constexpr | File (NativeType fileDescriptor) noexcept |
Conversion from a native file descriptor. | |
constexpr | File (File &&other) noexcept |
Move constructor. | |
~File () | |
Destructor. Silently closes the file. | |
auto | operator= (File &&rhs) noexcept -> File & |
Move assignment operator. | |
constexpr | operator NativeType () const noexcept |
Conversion to a native file descriptor. | |
constexpr | operator bool () const noexcept |
Checks whether the object contains a file descriptor. | |
auto | operator= (NativeType fileDescriptor) noexcept -> File & |
Assignment from a native file descriptor. | |
constexpr auto | release () noexcept -> NativeType |
Removes the file descriptor and passes ownership to the caller. | |
auto | close () noexcept -> bool |
Closes the file descriptor, if any. | |
Static Public Attributes | |
static constexpr int | kInvalid { -1 } |
An invalid file descriptor. | |
A Posix file descriptor that closes itself on destruct.
This class can be moved but not copied.
using xentara::utils::posix::File::NativeType = int |
A native Posix file descriptor.
|
constexprdefaultnoexcept |
Default constructor.
Creates an empty object that does not contain a file descriptor.
|
constexprnoexcept |
Conversion from a native file descriptor.
fileDescriptor | The file descriptor, or -1 for none. |
|
constexprnoexcept |
Move constructor.
Takes ownership of the other object's file descriptor, if any.
other | The object to move. Will be reset and no longer contain a file descriptor afterwards. |
xentara::utils::posix::File::~File | ( | ) |
Destructor. Silently closes the file.
|
noexcept |
Closes the file descriptor, if any.
|
explicitconstexprnoexcept |
Checks whether the object contains a file descriptor.
|
constexprnoexcept |
Conversion to a native file descriptor.
Move assignment operator.
Takes ownership of the other object's file descriptor, if any. Any existing file descriptor is silently closed.
rhs | The object to move. Will be reset and no longer contain a file descriptor afterwards. |
|
noexcept |
Assignment from a native file descriptor.
Any existing file descriptor is silently closed.
fileDescriptor | The new file descriptor, or -1 for none. |
|
constexprnoexcept |
Removes the file descriptor and passes ownership to the caller.
After this call, this object will no longer contain a file descriptor.
|
staticconstexpr |
An invalid file descriptor.