#include <Pt/System/IOBuffer.h>
Stream buffer for an IODevice. More...
Inherits BasicStreamBuffer< char >, and Connectable.
Public Member Functions | |
| IOBuffer (std::size_t bufferSize=8192, bool extend=false) | |
| Construct with buffer size. | |
| IOBuffer (IODevice &ioDevice, std::size_t bufferSize=8192, bool extend=false) | |
| Construct with I/O device. | |
| ~IOBuffer () | |
| Destructor. | |
| IODevice * | device () |
| Returns the I/O device. | |
| Signal< IOBuffer & > & | inputReady () |
| Notifies when input was read. | |
| Signal< IOBuffer & > & | outputReady () |
| Notifies when a part of the buffer was written. | |
| void | attach (IODevice &ioDevice) |
| Attach to I/O device. | |
| void | detach () |
| Detach from I/O device. | |
| void | reset () |
| Discards and detaches. | |
| void | discard () |
| Discards the buffer. | |
| void | beginRead () |
| Begins to read from the I/O device into the buffer. | |
| std::size_t | endRead () |
| Ends to read. | |
| void | beginWrite () |
| Begins to write buffered data to the I/O device. | |
| std::size_t | endWrite () |
| Ends writing buffered data to the I/O device. | |
| bool | isReading () const |
| Returns true if a read operation is running. | |
| bool | isWriting () const |
| Returns true if a write operation is running. | |
| std::streamsize | speekn (char *buffer, std::streamsize size) |
| Peek data in stream. | |
| std::streamsize | out_avail () |
| Returns the number of characters buffered for output. | |
Protected Member Functions | |
| virtual std::streamsize | showfull () |
| Returns the number of characters buffered for output. | |
IOBuffer is a std::streambuf that reads and writes an IODevice. attach() binds the buffer to a device. detach() unbinds it. discard() drops buffered bytes. reset() discards and detaches.
beginRead() fills the get area from the device. beginWrite() drains the put area to the device. Those transfers run through the device's EventLoop. inputReady and outputReady fire when a transfer finishes. endRead() and endWrite() complete it. isReading() and isWriting() report a transfer in progress.
IStream, OStream, and IOStream own an IOBuffer. Formatted extraction and insertion then use the attached device.