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

kopete/protocols/messenger/libpapillon

bytestream.h

Go to the documentation of this file.
00001 /*
00002  * bytestream.h - base class for bytestreams
00003  * Copyright (C) 2003  Justin Karneges <justin@affinix.com>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018  *
00019  */
00020 
00021 #ifndef CS_BYTESTREAM_H
00022 #define CS_BYTESTREAM_H
00023 
00024 #include <Papillon/Macros>
00025 
00026 #include <QtCore/QObject>
00027 #include <QtCore/QByteArray>
00028 
00029 // CS_NAMESPACE_BEGIN
00030 
00031 namespace Papillon
00032 {
00033 
00034 // CS_EXPORT_BEGIN
00035 class PAPILLON_EXPORT ByteStream : public QObject
00036 {
00037     Q_OBJECT
00038 public:
00039     enum Error { ErrRead, ErrWrite, ErrCustom = 10 };
00040     ByteStream(QObject *parent=0);
00041     virtual ~ByteStream()=0;
00042 
00043     virtual bool isOpen() const;
00044     virtual void close();
00045     virtual void write(const QByteArray &);
00046     virtual QByteArray read(int bytes=0);
00047     virtual int bytesAvailable() const;
00048     virtual int bytesToWrite() const;
00049 
00050     static void appendArray(QByteArray *a, const QByteArray &b);
00051     static QByteArray takeArray(QByteArray *from, int size=0, bool del=true);
00052 
00053 signals:
00054     void connectionClosed();
00055     void delayedCloseFinished();
00056     void readyRead();
00057     void bytesWritten(int);
00058     void error(int);
00059 
00060 protected:
00061     void clearReadBuffer();
00062     void clearWriteBuffer();
00063     void appendRead(const QByteArray &);
00064     void appendWrite(const QByteArray &);
00065     QByteArray takeRead(int size=0, bool del=true);
00066     QByteArray takeWrite(int size=0, bool del=true);
00067     QByteArray & readBuf();
00068     QByteArray & writeBuf();
00069     virtual int tryWrite();
00070 
00071 private:
00073     class Private;
00074     Private *d;
00076 };
00077 // CS_EXPORT_END
00078 }
00079 
00080 // CS_NAMESPACE_END
00081 
00082 #endif

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