~ubuntu-branches/ubuntu/wily/psi/wily-proposed

« back to all changes in this revision

Viewing changes to iris/src/xmpp/cutestuff/bytestream.h

  • Committer: Package Import Robot
  • Author(s): Jan Niehusmann
  • Date: 2014-07-01 21:49:34 UTC
  • mfrom: (6.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20140701214934-gt4dkgm94byi4vnn
Tags: 0.15-1
* New upstream version
* set debhelper compat level to 9
* set Standards-Version to 3.9.5 (no further changes)
* add lintian override regarding license-problem-non-free-RFC
* use qconf to regenerate configure script
* implement hardening using buildflags instead of hardening-wrapper

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * bytestream.h - base class for bytestreams
3
 
 * Copyright (C) 2003  Justin Karneges
4
 
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Lesser General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2.1 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Lesser General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
 *
19
 
 */
20
 
 
21
 
#ifndef CS_BYTESTREAM_H
22
 
#define CS_BYTESTREAM_H
23
 
 
24
 
#include <QObject>
25
 
#include <QByteArray>
26
 
 
27
 
// CS_NAMESPACE_BEGIN
28
 
 
29
 
// CS_EXPORT_BEGIN
30
 
class ByteStream : public QObject
31
 
{
32
 
        Q_OBJECT
33
 
public:
34
 
        enum Error { ErrRead, ErrWrite, ErrCustom = 10 };
35
 
        ByteStream(QObject *parent=0);
36
 
        virtual ~ByteStream()=0;
37
 
 
38
 
        virtual bool isOpen() const;
39
 
        virtual void close();
40
 
        virtual void write(const QByteArray &);
41
 
        virtual QByteArray read(int bytes=0);
42
 
        virtual int bytesAvailable() const;
43
 
        virtual int bytesToWrite() const;
44
 
 
45
 
        static void appendArray(QByteArray *a, const QByteArray &b);
46
 
        static QByteArray takeArray(QByteArray *from, int size=0, bool del=true);
47
 
 
48
 
signals:
49
 
        void connectionClosed();
50
 
        void delayedCloseFinished();
51
 
        void readyRead();
52
 
        void bytesWritten(int);
53
 
        void error(int);
54
 
 
55
 
protected:
56
 
        void clearReadBuffer();
57
 
        void clearWriteBuffer();
58
 
        void appendRead(const QByteArray &);
59
 
        void appendWrite(const QByteArray &);
60
 
        QByteArray takeRead(int size=0, bool del=true);
61
 
        QByteArray takeWrite(int size=0, bool del=true);
62
 
        QByteArray & readBuf();
63
 
        QByteArray & writeBuf();
64
 
        virtual int tryWrite();
65
 
 
66
 
private:
67
 
//! \if _hide_doc_
68
 
        class Private;
69
 
        Private *d;
70
 
//! \endif
71
 
};
72
 
// CS_EXPORT_END
73
 
 
74
 
// CS_NAMESPACE_END
75
 
 
76
 
#endif