KPty
kptydevice.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 00003 Copyright (C) 2007 Oswald Buddenhagen <ossi@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 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 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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 { //krazy:exclude=dpointer (via macro) 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: 00143 void readEof(); 00144 00145 protected: 00146 virtual qint64 readData(char *data, qint64 maxSize); 00147 virtual qint64 readLineData(char *data, qint64 maxSize); 00148 virtual qint64 writeData(const char *data, qint64 maxSize); 00149 00150 private: 00151 Q_PRIVATE_SLOT(d_func(), bool _k_canRead()) 00152 Q_PRIVATE_SLOT(d_func(), bool _k_canWrite()) 00153 }; 00154 00155 #endif 00156
KDE 4.6 API Reference