KPty
kptydevice.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef kptydev_h
00022 #define kptydev_h
00023
00024 #include "kpty.h"
00025
00026 #include <QtCore/QIODevice>
00027
00028 struct KPtyDevicePrivate;
00029
00030 #define Q_DECLARE_PRIVATE_MI(Class, SuperClass) \
00031 inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(SuperClass::d_ptr); } \
00032 inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(SuperClass::d_ptr); } \
00033 friend class Class##Private;
00034
00038 class KPTY_EXPORT KPtyDevice : public QIODevice, public KPty {
00039 Q_OBJECT
00040 Q_DECLARE_PRIVATE_MI(KPtyDevice, KPty)
00041
00042 public:
00043
00047 KPtyDevice(QObject *parent = 0);
00048
00055 virtual ~KPtyDevice();
00056
00062 virtual bool open(OpenMode mode = ReadWrite | Unbuffered);
00063
00077 bool open(int fd, OpenMode mode = ReadWrite | Unbuffered);
00078
00082 virtual void close();
00083
00096 void setSuspended(bool suspended);
00097
00106 bool isSuspended() const;
00107
00111 virtual bool isSequential() const;
00112
00116 bool canReadLine() const;
00117
00121 bool atEnd() const;
00122
00126 qint64 bytesAvailable() const;
00127
00131 qint64 bytesToWrite() const;
00132
00133 bool waitForBytesWritten(int msecs = -1);
00134 bool waitForReadyRead(int msecs = -1);
00135
00136
00137 Q_SIGNALS:
00139 void readyRead();
00140
00146 void readEof();
00147
00148 protected:
00149 virtual qint64 readData(char *data, qint64 maxSize);
00150 virtual qint64 readLineData(char *data, qint64 maxSize);
00151 virtual qint64 writeData(const char *data, qint64 maxSize);
00152
00153 private:
00154 Q_PRIVATE_SLOT(d_func(), bool _k_canRead())
00155 Q_PRIVATE_SLOT(d_func(), bool _k_canWrite())
00156 };
00157
00158 #endif
00159