kopete/protocols/messenger/libpapillon
Papillon::ByteStream Class Reference
#include <bytestream.h>

Detailed Description
Provides the base implementation for all ByteStreams.
Definition at line 35 of file bytestream.h.
Public Types | |
| enum | Error { ErrRead, ErrWrite, ErrCustom = 10 } |
Signals | |
| void | bytesWritten (int) |
| void | connectionClosed () |
| void | delayedCloseFinished () |
| void | error (int) |
| void | readyRead () |
Public Member Functions | |
| virtual int | bytesAvailable () const |
| virtual int | bytesToWrite () const |
| ByteStream (QObject *parent=0) | |
| virtual void | close () |
| virtual bool | isOpen () const |
| virtual QByteArray | read (int bytes=0) |
| virtual void | write (const QByteArray &) |
| virtual | ~ByteStream ()=0 |
Static Public Member Functions | |
| static void | appendArray (QByteArray *a, const QByteArray &b) |
| static QByteArray | takeArray (QByteArray *from, int size=0, bool del=true) |
Protected Member Functions | |
| void | appendRead (const QByteArray &) |
| void | appendWrite (const QByteArray &) |
| void | clearReadBuffer () |
| void | clearWriteBuffer () |
| QByteArray & | readBuf () |
| QByteArray | takeRead (int size=0, bool del=true) |
| QByteArray | takeWrite (int size=0, bool del=true) |
| virtual int | tryWrite () |
| QByteArray & | writeBuf () |
Member Enumeration Documentation
Constructor & Destructor Documentation
| ByteStream::ByteStream | ( | QObject * | parent = 0 |
) |
| ByteStream::~ByteStream | ( | ) | [pure virtual] |
Member Function Documentation
| void ByteStream::appendArray | ( | QByteArray * | a, | |
| const QByteArray & | b | |||
| ) | [static] |
Append array b to the end of the array pointed to by a.
Definition at line 205 of file bytestream.cpp.
| void ByteStream::appendRead | ( | const QByteArray & | block | ) | [protected] |
| void ByteStream::appendWrite | ( | const QByteArray & | block | ) | [protected] |
| int ByteStream::bytesAvailable | ( | ) | const [virtual] |
| int ByteStream::bytesToWrite | ( | ) | const [virtual] |
Returns the number of bytes that are waiting to be written.
Definition at line 130 of file bytestream.cpp.
| void Papillon::ByteStream::bytesWritten | ( | int | ) | [signal] |
| void ByteStream::clearReadBuffer | ( | ) | [protected] |
| void ByteStream::clearWriteBuffer | ( | ) | [protected] |
| void ByteStream::close | ( | ) | [virtual] |
Closes the stream.
If there is data in the write buffer then it will be written before actually closing the stream. Once all data has been written, the delayedCloseFinished() signal will be emitted.
- See also:
- delayedCloseFinished()
Reimplemented in Papillon::QtByteStream.
Definition at line 96 of file bytestream.cpp.
| void Papillon::ByteStream::connectionClosed | ( | ) | [signal] |
| void Papillon::ByteStream::delayedCloseFinished | ( | ) | [signal] |
| void Papillon::ByteStream::error | ( | int | ) | [signal] |
| bool ByteStream::isOpen | ( | ) | const [virtual] |
Returns TRUE if the stream is open, meaning that you can write to it.
Reimplemented in Papillon::QtByteStream.
Definition at line 86 of file bytestream.cpp.
| QByteArray ByteStream::read | ( | int | bytes = 0 |
) | [virtual] |
Reads bytes bytes of data from the stream and returns them as an array.
If bytes is 0, then read will return all available data.
Definition at line 116 of file bytestream.cpp.
| QByteArray & ByteStream::readBuf | ( | ) | [protected] |
| void Papillon::ByteStream::readyRead | ( | ) | [signal] |
| QByteArray ByteStream::takeArray | ( | QByteArray * | from, | |
| int | size = 0, |
|||
| bool | del = true | |||
| ) | [static] |
Returns size bytes from the start of the array pointed to by from.
If size is 0, then all available data will be returned. If del is TRUE, then the bytes are also removed.
Definition at line 216 of file bytestream.cpp.
| QByteArray ByteStream::takeRead | ( | int | size = 0, |
|
| bool | del = true | |||
| ) | [protected] |
Returns size bytes from the start of the read buffer.
If size is 0, then all available data will be returned. If del is TRUE, then the bytes are also removed.
Definition at line 167 of file bytestream.cpp.
| QByteArray ByteStream::takeWrite | ( | int | size = 0, |
|
| bool | del = true | |||
| ) | [protected] |
Returns size bytes from the start of the write buffer.
If size is 0, then all available data will be returned. If del is TRUE, then the bytes are also removed.
Definition at line 176 of file bytestream.cpp.
| int ByteStream::tryWrite | ( | ) | [protected, virtual] |
Attempts to try and write some bytes from the write buffer, and returns the number successfully written or -1 on error.
The default implementation returns -1.
Reimplemented in Papillon::QtByteStream.
Definition at line 198 of file bytestream.cpp.
| void ByteStream::write | ( | const QByteArray & | a | ) | [virtual] |
| QByteArray & ByteStream::writeBuf | ( | ) | [protected] |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference