#include <bdls_filedescriptorguard.h>
This class implements a guard that conditionally closes an open file descriptor upon its destruction.
See bdls_filedescriptorguard
◆ FileDescriptorGuard()
| bdls::FileDescriptorGuard::FileDescriptorGuard |
( |
FilesystemUtil::FileDescriptor |
descriptor | ) |
|
|
inlineexplicit |
Create a guard object that will manage the specified descriptor, closing it upon destruction (unless either realease or closeAndRelease has been called). It is permissible for descriptor to be FilesystemUtil::k_INVALID_FD, in which case the guard created will not manage anything.
◆ ~FileDescriptorGuard()
| bdls::FileDescriptorGuard::~FileDescriptorGuard |
( |
| ) |
|
|
inline |
If this guard object manages a file, close that file.
◆ closeAndRelease()
| void bdls::FileDescriptorGuard::closeAndRelease |
( |
| ) |
|
Close the file managed by this guard and release that file from management by this object.
- Precondition
- The behavior is undefined unless this object is managing a file.
◆ descriptor()
| FilesystemUtil::FileDescriptor bdls::FileDescriptorGuard::descriptor |
( |
| ) |
const |
|
inline |
◆ release()
| FilesystemUtil::FileDescriptor bdls::FileDescriptorGuard::release |
( |
| ) |
|
|
inline |
Release the file from management by this object (without closing it) and return the formerly managed descriptor.
- Precondition
- The behavior is undefined unless this object is managing a file.
◆ d_descriptor
| FilesystemUtil::FileDescriptor bdls::FileDescriptorGuard::d_descriptor |
The documentation for this struct was generated from the following file: