• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/protocols/messenger/libpapillon

Papillon::ByteStream

Papillon::ByteStream Class Reference

#include <bytestream.h>

Inheritance diagram for Papillon::ByteStream:

Inheritance graph
[legend]

List of all members.


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 connectionClosed ()
void delayedCloseFinished ()
void readyRead ()
void bytesWritten (int)
void error (int)

Public Member Functions

 ByteStream (QObject *parent=0)
virtual ~ByteStream ()=0
virtual bool isOpen () const
virtual void close ()
virtual void write (const QByteArray &)
virtual QByteArray read (int bytes=0)
virtual int bytesAvailable () const
virtual int bytesToWrite () const

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 clearReadBuffer ()
void clearWriteBuffer ()
void appendRead (const QByteArray &)
void appendWrite (const QByteArray &)
QByteArray takeRead (int size=0, bool del=true)
QByteArray takeWrite (int size=0, bool del=true)
QByteArray & readBuf ()
QByteArray & writeBuf ()
virtual int tryWrite ()

Member Enumeration Documentation

enum Papillon::ByteStream::Error

Enumerator:
ErrRead 
ErrWrite 
ErrCustom 

Definition at line 39 of file bytestream.h.


Constructor & Destructor Documentation

ByteStream::ByteStream ( QObject *  parent = 0  ) 

Constructs a ByteStream object with parent parent.

Definition at line 71 of file bytestream.cpp.

ByteStream::~ByteStream (  )  [pure virtual]

Destroys the object and frees allocated resources.

Definition at line 79 of file bytestream.cpp.


Member Function Documentation

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.

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 ByteStream::write ( const QByteArray &  a  )  [virtual]

Writes array a to the stream.

Definition at line 102 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.

int ByteStream::bytesAvailable (  )  const [virtual]

Returns the number of bytes available for reading.

Definition at line 123 of file bytestream.cpp.

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 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.

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.

void Papillon::ByteStream::connectionClosed (  )  [signal]

void Papillon::ByteStream::delayedCloseFinished (  )  [signal]

void Papillon::ByteStream::readyRead (  )  [signal]

void Papillon::ByteStream::bytesWritten ( int   )  [signal]

void Papillon::ByteStream::error ( int   )  [signal]

void ByteStream::clearReadBuffer (  )  [protected]

Clears the read buffer.

Definition at line 137 of file bytestream.cpp.

void ByteStream::clearWriteBuffer (  )  [protected]

Clears the write buffer.

Definition at line 144 of file bytestream.cpp.

void ByteStream::appendRead ( const QByteArray &  block  )  [protected]

Appends block to the end of the read buffer.

Definition at line 151 of file bytestream.cpp.

void ByteStream::appendWrite ( const QByteArray &  block  )  [protected]

Appends block to the end of the write buffer.

Definition at line 158 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.

QByteArray & ByteStream::readBuf (  )  [protected]

Returns a reference to the read buffer.

Definition at line 183 of file bytestream.cpp.

QByteArray & ByteStream::writeBuf (  )  [protected]

Returns a reference to the write buffer.

Definition at line 190 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.


The documentation for this class was generated from the following files:
  • bytestream.h
  • bytestream.cpp

kopete/protocols/messenger/libpapillon

Skip menu "kopete/protocols/messenger/libpapillon"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal