UCommon
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
ucommon::filestream Class Reference

Streamable tcp connection between client and server. More...

#include <stream.h>

Inheritance diagram for ucommon::filestream:
Inheritance graph
[legend]
Collaboration diagram for ucommon::filestream:
Collaboration graph
[legend]

Public Types

enum  access_t { RDONLY, WRONLY, RDWR }

Public Member Functions

void close (void)
 Close an active stream connection.
void create (const char *filename, fsys::access_t access, unsigned mode, size_t buffering=512)
 Create a stream connection to a tcp service.
int err (void) const
 Get error flag from last i/o operation.
 filestream ()
 Create an unopened pipe stream.
 filestream (const filestream &copy)
 Create duplicate stream.
 filestream (const char *path, fsys::access_t access, unsigned mode, size_t bufsize)
 Create file stream.
 filestream (const char *path, fsys::access_t access, size_t bufsize)
 Open file stream.
void open (const char *filename, fsys::access_t access, size_t buffering=512)
 Open 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 seek (fsys::offset_t offset)
 Seek position.
virtual ~filestream ()
 Destroy a file stream.
- Public Member Functions inherited from ucommon::StreamProtocol
bool is_open (void)
 operator bool ()
bool operator! ()
int sync (void)
 Flush the stream input and output buffers, writes pending output.
- Public Member Functions inherited from ucommon::CharacterProtocol
int get (void)
 Get the next character.
int put (int code)
 Put the next character.

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Streamable tcp connection between client and server.

The tcp stream class can represent a client connection to a server or an instance of a service generated by a tcp listener. As a stream class, data can be manipulated using the << and >> operators.

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

Definition at line 340 of file stream.h.

Member Function Documentation

int ucommon::filestream::_getch ( void  )
protectedvirtual

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

Returns
char from get buffer, EOF if not connected.

Implements ucommon::CharacterProtocol.

int ucommon::filestream::_putch ( int  ch)
protectedvirtual

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

Parameters
chchar to push through.
Returns
char pushed through.

Implements ucommon::CharacterProtocol.

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

Get error flag from last i/o operation.

Returns
last error.

Definition at line 437 of file stream.h.

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

See if stream connection is active.

Returns
true if stream is active.

Definition at line 403 of file stream.h.

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

See if stream is disconnected.

Returns
true if stream disconnected.

Definition at line 410 of file stream.h.


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