libept
Public Member Functions | Protected Attributes | List of all members
ept::sys::NamedFileDescriptor Class Reference

File descriptor with a name. More...

#include <sys.h>

Inheritance diagram for ept::sys::NamedFileDescriptor:
ept::sys::FileDescriptor ept::sys::File ept::sys::Path

Public Member Functions

 NamedFileDescriptor (int fd, const std::string &pathname)
 
 NamedFileDescriptor (NamedFileDescriptor &&)
 
NamedFileDescriptoroperator= (NamedFileDescriptor &&)
 
virtual void throw_error (const char *desc)
 Throw an exception based on errno and the given message. More...
 
const std::string & name () const
 Return the file pathname. More...
 
- Public Member Functions inherited from ept::sys::FileDescriptor
 FileDescriptor ()
 
 FileDescriptor (FileDescriptor &&o)
 
 FileDescriptor (int fd)
 
virtual ~FileDescriptor ()
 
void close ()
 
void fstat (struct stat &st)
 
void fchmod (mode_t mode)
 
size_t write (const void *buf, size_t count)
 
void write_all (const void *buf, size_t count)
 Write all the data in buf, retrying partial writes. More...
 
MMap mmap (size_t length, int prot, int flags, off_t offset=0)
 
 operator int () const
 

Protected Attributes

std::string pathname
 
- Protected Attributes inherited from ept::sys::FileDescriptor
int fd = -1
 

Detailed Description

File descriptor with a name.

Constructor & Destructor Documentation

◆ NamedFileDescriptor() [1/2]

ept::sys::NamedFileDescriptor::NamedFileDescriptor ( int  fd,
const std::string &  pathname 
)

◆ NamedFileDescriptor() [2/2]

ept::sys::NamedFileDescriptor::NamedFileDescriptor ( NamedFileDescriptor &&  o)

Member Function Documentation

◆ name()

const std::string& ept::sys::NamedFileDescriptor::name ( ) const
inline

Return the file pathname.

Referenced by ept::sys::Path::rmtree(), ept::sys::which(), and ept::sys::write_file_atomically().

◆ operator=()

NamedFileDescriptor & ept::sys::NamedFileDescriptor::operator= ( NamedFileDescriptor &&  o)

◆ throw_error()

void ept::sys::NamedFileDescriptor::throw_error ( const char *  desc)
virtual

Throw an exception based on errno and the given message.

This can be overridden by subclasses that may have more information about the file descriptor, so that they can generate more descriptive messages.

Reimplemented from ept::sys::FileDescriptor.

References pathname.

Referenced by ept::sys::Path::fdopendir(), ept::sys::Path::fstatat(), ept::sys::Path::lstatat(), ept::sys::Path::openat(), ept::sys::Path::iterator::operator++(), ept::sys::Path::Path(), ept::sys::Path::rmdirat(), and ept::sys::Path::unlinkat().

Member Data Documentation

◆ pathname

std::string ept::sys::NamedFileDescriptor::pathname
protected

Referenced by operator=(), and throw_error().


The documentation for this class was generated from the following files: