Evo C++ Library v0.5.1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
IoFile Struct Reference

#include <evo/impl/sysio.h>

Inheritance diagram for IoFile:
Inheritance graph
[legend]

Detailed Description

File I/O device (used internally).

Public Types

typedef ExceptionFileIn ExceptionInT
 Input exception type for file stream. More...
 
typedef ExceptionFileOut ExceptionOutT
 Output exception type for file stream. More...
 
typedef int Handle
 System file handle. More...
 

Public Member Functions

 IoFile ()
 Constructor. More...
 
 ~IoFile ()
 Destructor. More...
 
void close ()
 
Handle detach ()
 Detach and return file handle. More...
 
bool isopen () const
 Get whether file is open. More...
 
Error open (const char *path, Open mode, int perm=DEFPERM)
 Open file for access. More...
 
Error open_dup (Handle src, Handle target=INVALID)
 Open duplicate handle from source handle. More...
 
ulongl pos (Error &err)
 Get current file position. More...
 
ulong read (Error &err, void *buf, ulong size, ulong timeout_ms=0)
 
ulongl seek (Error &err, ulongl offset, Seek start=sBegin)
 Seek to file position. More...
 
ulong write (Error &err, const void *buf, ulong size, ulong timeout_ms=0)
 

Static Public Member Functions

static Error mkdir (const char *path, int perm=0)
 
static Error rm (const char *path)
 
static Error rmdir (const char *path)
 

Public Attributes

bool autoresume
 Whether to auto-resume I/O operation after signal received [Linux/Unix]. More...
 
Handle handle
 System handle/descriptor. More...
 

Static Public Attributes

static const int DEFPERM = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH
 Default permissions (used when creating new file). More...
 
static const Handle INVALID = -1
 Invalid handle value. More...
 
static const int READONLY = S_IRUSR | S_IRGRP | S_IROTH
 Read-only permissions. More...
 
static const bool STREAM_SEEKABLE = true
 File streams are seekable with Stream. More...
 
static const int USER_RD = S_IRUSR
 User read-only permissions. More...
 
static const int USER_RW = S_IRUSR | S_IWUSR
 User read-write permissions. More...
 

Member Typedef Documentation

◆ ExceptionInT

Input exception type for file stream.

◆ ExceptionOutT

Output exception type for file stream.

◆ Handle

typedef int Handle

System file handle.

Constructor & Destructor Documentation

◆ ~IoFile()

~IoFile ( )
inline

Destructor.

Calls close().

◆ IoFile()

IoFile ( )
inline

Constructor.

Member Function Documentation

◆ close()

void close ( )
inline

◆ detach()

Handle detach ( )
inline

Detach and return file handle.

Returns
File handle

◆ isopen()

bool isopen ( ) const
inline

Get whether file is open.

Returns
Whether file is open

◆ mkdir()

static Error mkdir ( const char *  path,
int  perm = 0 
)
inlinestatic

◆ open()

Error open ( const char *  path,
Open  mode,
int  perm = DEFPERM 
)
inline

Open file for access.

Parameters
pathFile path to use
modeAccess mode to use
permPermissions for new files [Linux/Unix]
Returns
ENone on success, error code on other error

◆ open_dup()

Error open_dup ( Handle  src,
Handle  target = INVALID 
)
inline

Open duplicate handle from source handle.

Parameters
srcSource handle to duplicate
targetTarget handle to open under (closed first, if open), INVALID to ignore and open a new handle
Returns
ENone on success, error code on other error

◆ pos()

ulongl pos ( Error err)
inline

Get current file position.

Parameters
errStores ENone on success, error code on error [out]
Returns
File byte position, 0 for beginning or error

◆ read()

ulong read ( Error err,
void *  buf,
ulong  size,
ulong  timeout_ms = 0 
)
inline

◆ rm()

static Error rm ( const char *  path)
inlinestatic

◆ rmdir()

static Error rmdir ( const char *  path)
inlinestatic

◆ seek()

ulongl seek ( Error err,
ulongl  offset,
Seek  start = sBegin 
)
inline

Seek to file position.

Parameters
errStores ENone on success, error code on error [out]
offsetOffset from start to seek to
startStart position to seek from
Returns
New file position after seek, 0 for beginning or error

◆ write()

ulong write ( Error err,
const void *  buf,
ulong  size,
ulong  timeout_ms = 0 
)
inline

Member Data Documentation

◆ autoresume

bool autoresume

Whether to auto-resume I/O operation after signal received [Linux/Unix].

◆ DEFPERM

const int DEFPERM = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH
static

Default permissions (used when creating new file).

◆ handle

Handle handle

System handle/descriptor.

◆ INVALID

const Handle INVALID = -1
static

Invalid handle value.

◆ READONLY

const int READONLY = S_IRUSR | S_IRGRP | S_IROTH
static

Read-only permissions.

◆ STREAM_SEEKABLE

const bool STREAM_SEEKABLE = true
static

File streams are seekable with Stream.

◆ USER_RD

const int USER_RD = S_IRUSR
static

User read-only permissions.

◆ USER_RW

const int USER_RW = S_IRUSR | S_IWUSR
static

User read-write permissions.


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