ewmscp  ..
Public Member Functions | Private Attributes | List of all members
scoped::Fd Class Reference

#include <scoped.h>

Collaboration diagram for scoped::Fd:
[legend]

Public Member Functions

 Fd (const std::string &Name, int _Fd)
 
 ~Fd ()
 
int operator() ()
 
 operator int ()
 
 operator int () const
 

Private Attributes

int fd
 
const std::string & name
 

Detailed Description

Definition at line 48 of file scoped.h.

Constructor & Destructor Documentation

◆ Fd()

scoped::Fd::Fd ( const std::string &  Name,
int  _Fd 
)
inline

Definition at line 52 of file scoped.h.

52  :
53  fd(_Fd),
54  name(Name) {
55  }

◆ ~Fd()

scoped::Fd::~Fd ( )
inline

Definition at line 56 of file scoped.h.

56  {
57  if (fd != -1) { // don't choke on non-open files...
58  throwcall::good0(close(fd), "can't close ", name);
59  }
60  }

References throwcall::good0().

Here is the call graph for this function:

Member Function Documentation

◆ operator int() [1/2]

scoped::Fd::operator int ( )
inline

Definition at line 64 of file scoped.h.

64  {
65  return fd;
66  }

◆ operator int() [2/2]

scoped::Fd::operator int ( ) const
inline

Definition at line 67 of file scoped.h.

67  {
68  return fd;
69  }

◆ operator()()

int scoped::Fd::operator() ( )
inline

Definition at line 61 of file scoped.h.

61  {
62  return fd;
63  }

Member Data Documentation

◆ fd

int scoped::Fd::fd
private

Definition at line 49 of file scoped.h.

◆ name

const std::string& scoped::Fd::name
private

Definition at line 50 of file scoped.h.


The documentation for this class was generated from the following file:
scoped::Fd::fd
int fd
Definition: scoped.h:49
scoped::Fd::name
const std::string & name
Definition: scoped.h:50
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40