UCommon
ucommon::filestream Class Reference

Streamable file class based on low level fsys io. More...

#include <stream.h>

Inheritance diagram for ucommon::filestream:
Collaboration diagram for ucommon::filestream:

Public Types

enum  access_t { RDONLY , WRONLY , RDWR }
 

Public Member Functions

void close (void)
 Close an active stream connection.
 
int err (void) const
 Get error flag from last i/o operation.
 
 filestream ()
 Create an unopened pipe stream.
 
 filestream (const char *path, fsys::access_t access, size_t bufsize=512)
 Open file stream.
 
 filestream (const char *path, unsigned mode, fsys::access_t access, size_t bufsize=512)
 Create and open a file stream.
 
 filestream (const filestream &copy)
 Create duplicate stream.
 
void open (const char *filename, fsys::access_t access, size_t buffering=512)
 Open a stream connection to a tcp service.
 
void open (const char *filename, unsigned mode, fsys::access_t access, size_t buffering=512)
 Create a stream connection to a tcp service.
 
 operator bool () const
 See if stream connection is active.
 
bool operator! () const
 See if stream is disconnected.
 
void rewind (void)
 
void seek (fsys::offset_t offset)
 Seek position.
 
virtual ~filestream ()
 Destroy a file stream.
 
- Public Member Functions inherited from ucommon::StreamBuffer
bool is_open (void) const
 
 operator bool () const
 
bool operator! () const
 
int sync (void)
 Flush the stream input and output buffers, writes pending output.
 

Protected Member Functions

int overflow (int ch)
 This streambuf method is used to write the output buffer through the established pipe connection.
 
int underflow (void)
 This streambuf method is used to load the input buffer through the established pipe connection.
 
- Protected Member Functions inherited from ucommon::StreamBuffer
void allocate (size_t size)
 
void release (void)
 
int uflow ()
 This streambuf method is used for doing unbuffered reads through the establish tcp socket connection when in interactive mode.
 

Protected Attributes

fsys::access_t ac
 
fsys_t fd
 
- Protected Attributes inherited from ucommon::StreamBuffer
size_t bufsize
 
char * gbuf
 
char * pbuf
 

Detailed Description

Streamable file class based on low level fsys io.

This differs from the normal fstream classes as it may apply to other kinds of file streams.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 347 of file stream.h.

Member Enumeration Documentation

◆ access_t

enum ucommon::filestream::access_t

Definition at line 350 of file stream.h.

Member Function Documentation

◆ err()

int ucommon::filestream::err ( void ) const
inline

Get error flag from last i/o operation.

Returns
last error.

Definition at line 448 of file stream.h.

Here is the call graph for this function:

◆ operator bool()

ucommon::filestream::operator bool ( ) const
inline

See if stream connection is active.

Returns
true if stream is active.

Definition at line 410 of file stream.h.

◆ operator!()

bool ucommon::filestream::operator! ( ) const
inline

See if stream is disconnected.

Returns
true if stream disconnected.

Definition at line 418 of file stream.h.

◆ overflow()

int ucommon::filestream::overflow ( int ch)
protected

This streambuf method is used to write the output buffer through the established pipe connection.

Parameters
chchar to push through.
Returns
char pushed through.

◆ underflow()

int ucommon::filestream::underflow ( void )
protected

This streambuf method is used to load the input buffer through the established pipe connection.

Returns
char from get buffer, EOF if not connected.

Field Documentation

◆ ac

fsys::access_t ucommon::filestream::ac
protected

Definition at line 361 of file stream.h.

◆ fd

fsys_t ucommon::filestream::fd
protected

Definition at line 360 of file stream.h.


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