LibSWOC++ 1.5.14
Solid Wall of C++
Loading...
Searching...
No Matches
swoc::file::unique_fd Struct Reference

Scoped container for a file descriptor. More...

#include <swoc_file.h>

Collaboration diagram for swoc::file::unique_fd:
Collaboration graph

Public Types

using self_type = unique_fd
 Self reference type.
 

Public Member Functions

 unique_fd (int fd)
 
 unique_fd (self_type const &)=delete
 Non-copyable.
 
 unique_fd (self_type &&that)
 
 ~unique_fd ()
 Close the file dscriptor.
 
int release ()
 
 operator int () const
 Implicitly convert to file descriptor.
 

Protected Attributes

int _fd = NO_FD
 

Detailed Description

Scoped container for a file descriptor.

Definition at line 43 of file swoc_file.h.

Member Typedef Documentation

◆ self_type

Self reference type.

Definition at line 44 of file swoc_file.h.

Constructor & Destructor Documentation

◆ unique_fd() [1/2]

swoc::file::unique_fd::unique_fd ( int fd)
inlineexplicit

Construct with file descriptor.

Parameters
fdFile descriptor.

The instance takes owernship of the file descriptor.

Definition at line 52 of file swoc_file.h.

◆ unique_fd() [2/2]

swoc::file::unique_fd::unique_fd ( self_type && that)
inline

Move construction.

Parameters
thatSource instance.

Ownership is from from @Wa that to this.

Definition at line 63 of file swoc_file.h.

◆ ~unique_fd()

swoc::file::unique_fd::~unique_fd ( )
inline

Close the file dscriptor.

Definition at line 66 of file swoc_file.h.

Member Function Documentation

◆ operator int()

swoc::file::unique_fd::operator int ( ) const
inline

Implicitly convert to file descriptor.

Definition at line 85 of file swoc_file.h.

◆ release()

int swoc::file::unique_fd::release ( )
inline

Release ownership of the file descriptor.

Returns
The file descriptor.

Definition at line 78 of file swoc_file.h.

Member Data Documentation

◆ _fd

int swoc::file::unique_fd::_fd = NO_FD
protected

Definition at line 88 of file swoc_file.h.


The documentation for this struct was generated from the following file: