Yate
|
An abstract stream class capable of reading and writing. More...
#include <yateclass.h>
Public Types | |
enum | SeekPos { SeekBegin, SeekEnd, SeekCurrent } |
Public Member Functions | |
virtual | ~Stream () |
int | error () const |
virtual bool | terminate ()=0 |
virtual bool | canRetry () const |
virtual bool | inProgress () const |
virtual bool | valid () const =0 |
virtual bool | setBlocking (bool block=true) |
virtual int | writeData (const void *buffer, int length)=0 |
int | writeData (const char *str) |
int | writeData (const String &str) |
int | writeData (const DataBlock &buf) |
virtual int | readData (void *buffer, int length)=0 |
virtual int64_t | length () |
virtual int64_t | seek (SeekPos pos, int64_t offset=0) |
int64_t | seek (int64_t offset) |
Static Public Member Functions | |
static bool | allocPipe (Stream *&reader, Stream *&writer) |
static bool | allocPair (Stream *&str1, Stream *&str2) |
static bool | supportsPipes () |
static bool | supportsPairs () |
Protected Member Functions | |
Stream () | |
void | clearError () |
Protected Attributes | |
int | m_error |
An abstract stream class capable of reading and writing.
Base class for encapsulating system dependent stream capable objects
enum SeekPos |
Enumerate seek start position
|
virtual |
Destructor, terminates the stream
|
inlineprotected |
Default constructor
Allocate a new pair of bidirectionally connected streams
str1 | Reference of a pointer receiving the newly allocated 1st end of the pair |
str2 | Reference of a pointer receiving the newly allocated 2nd end of the pair |
Allocate a new pair of unidirectionally pipe connected streams
reader | Reference of a pointer receiving the newly allocated reading side of the pipe |
writer | Reference of a pointer receiving the newly allocated writing side of the pipe |
|
virtual |
|
inlineprotected |
Clear the last error code
|
inline |
Get the error code of the last operation on this stream
|
virtual |
Check if the last error code indicates a non blocking operation in progress
Reimplemented in Socket.
|
virtual |
Find the length of the stream if it has one
Reimplemented in File, and MemoryStream.
|
pure virtual |
Receive data from a connected stream
buffer | Buffer for data transfer |
length | Length of the buffer |
Implemented in Socket, File, and MemoryStream.
|
virtual |
Set the stream read/write pointer
pos | The seek start as enumeration |
offset | The number of bytes to move the pointer from starting position |
Reimplemented in File, and MemoryStream.
Referenced by Stream::seek().
|
inline |
Set the read/write pointer from begin of stream
offset | The position in stream to move the pointer |
References Stream::seek().
|
virtual |
|
static |
Check if operating system supports bidirectional stream pairs
|
static |
Check if operating system supports unidirectional stream pairs
|
pure virtual |
Closes the stream
Implemented in Socket, File, and MemoryStream.
|
pure virtual |
Check if this stream is valid
Implemented in Socket, File, and MemoryStream.
|
pure virtual |
Write data to a connected stream
buffer | Buffer for data transfer |
length | Length of the buffer |
Implemented in Socket, File, and MemoryStream.
Referenced by Stream::writeData().
int writeData | ( | const char * | str | ) |
Write a C string to a connected stream
str | String to send over the stream |
|
inline |
Write a String to a connected stream
str | String to send over the stream |
References String::c_str(), String::length(), and Stream::writeData().
|
inline |
Write a Data block to a connected stream
buf | DataBlock to send over the stream |
References DataBlock::data(), DataBlock::length(), and Stream::writeData().