Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
file Class Reference

#include <posix.h>

Public Types

enum  { RDONLY = FMT_POSIX(O_RDONLY), WRONLY = FMT_POSIX(O_WRONLY), RDWR = FMT_POSIX(O_RDWR) }
 

Public Member Functions

 file () FMT_NOEXCEPT
 
FMT_API file (cstring_view path, int oflag)
 
 file (file &&other) FMT_NOEXCEPT
 
fileoperator= (file &&other)
 
FMT_API ~file () FMT_NOEXCEPT
 
int descriptor () const FMT_NOEXCEPT
 
FMT_API void close ()
 
FMT_API long long size () const
 
FMT_API std::size_t read (void *buffer, std::size_t count)
 
FMT_API std::size_t write (const void *buffer, std::size_t count)
 
FMT_API void dup2 (int fd)
 
FMT_API void dup2 (int fd, error_code &ec) FMT_NOEXCEPT
 
FMT_API buffered_file fdopen (const char *mode)
 

Static Public Member Functions

static FMT_API file dup (int fd)
 
static FMT_API void pipe (file &read_end, file &write_end)
 

Private Member Functions

 file (int fd)
 
 file (const file &)=delete
 
void operator= (const file &)=delete
 

Private Attributes

int fd_
 

Detailed Description

Definition at line 188 of file posix.h.

Member Enumeration Documentation

anonymous enum
Enumerator
RDONLY 
WRONLY 
RDWR 

Definition at line 197 of file posix.h.

197  {
198  RDONLY = FMT_POSIX(O_RDONLY), // Open for reading only.
199  WRONLY = FMT_POSIX(O_WRONLY), // Open for writing only.
200  RDWR = FMT_POSIX(O_RDWR) // Open for reading and writing.
201  };
#define FMT_POSIX(call)
Definition: posix.h:35

Constructor & Destructor Documentation

file::file ( int  fd)
inlineexplicitprivate

Definition at line 193 of file posix.h.

193 : fd_(fd) {}
int fd_
Definition: posix.h:190
file::file ( )
inline

Definition at line 204 of file posix.h.

204 : fd_(-1) {}
int fd_
Definition: posix.h:190
FMT_API file::file ( cstring_view  path,
int  oflag 
)
file::file ( const file )
privatedelete
file::file ( file &&  other)
inline

Definition at line 214 of file posix.h.

214  : fd_(other.fd_) {
215  other.fd_ = -1;
216  }
int fd_
Definition: posix.h:190
FMT_API file::~file ( )

Member Function Documentation

FMT_API void file::close ( )
int file::descriptor ( ) const
inline

Definition at line 229 of file posix.h.

229 { return fd_; }
int fd_
Definition: posix.h:190
static FMT_API file file::dup ( int  fd)
static
FMT_API void file::dup2 ( int  fd)
FMT_API void file::dup2 ( int  fd,
error_code ec 
)
FMT_API buffered_file file::fdopen ( const char *  mode)
void file::operator= ( const file )
privatedelete
file& file::operator= ( file &&  other)
inline

Definition at line 218 of file posix.h.

218  {
219  close();
220  fd_ = other.fd_;
221  other.fd_ = -1;
222  return *this;
223  }
int fd_
Definition: posix.h:190
FMT_API void close()
static FMT_API void file::pipe ( file read_end,
file write_end 
)
static
FMT_API std::size_t file::read ( void *  buffer,
std::size_t  count 
)
FMT_API long long file::size ( ) const
FMT_API std::size_t file::write ( const void *  buffer,
std::size_t  count 
)

Member Data Documentation

int file::fd_
private

Definition at line 190 of file posix.h.


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