KDECore
kprocio.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 #ifndef KPROCIO_H_
00019 #define KPROCIO_H_
00020
00021 #include <qstring.h>
00022 #include <kprocess.h>
00023 #include <qstrlist.h>
00024 #include "kdelibs_export.h"
00025
00026 class KProcIOPrivate;
00027 class QTextCodec;
00028
00050 class KDECORE_EXPORT KProcIO : public KProcess
00051 {
00052 Q_OBJECT
00053
00054 public:
00058 KProcIO ( QTextCodec *codec = 0 );
00059
00063 ~KProcIO();
00064
00072 void setComm (Communication comm);
00073
00088 bool start (RunMode runmode = NotifyOnExit, bool includeStderr = false);
00089
00096 bool writeStdin(const QString &line, bool appendnewline=true);
00097
00104 bool writeStdin(const QCString &line, bool appendnewline);
00105
00111 bool writeStdin(const QByteArray &data);
00112
00113
00114
00123 KDE_DEPRECATED bool fputs (const QString &line, bool AppendNewLine=true)
00124 { return writeStdin(line, AppendNewLine); }
00125
00129 void closeWhenDone();
00130
00152 int readln (QString &line, bool autoAck=true, bool *partial=0);
00153
00162 KDE_DEPRECATED int fgets (QString &line, bool autoAck=false)
00163 { return readln (line, autoAck); }
00164
00168 void resetAll ();
00169
00179 void ackRead ();
00180
00187 void enableReadSignals (bool enable);
00188
00189 signals:
00195 void readReady(KProcIO *pio);
00196
00197 protected:
00198 QPtrList<QByteArray> outbuffer;
00199 QCString recvbuffer;
00200 QTextCodec *codec;
00201 int rbi;
00202 bool needreadsignal, readsignalon, writeready;
00203
00204 void controlledEmission ();
00205
00206 protected slots:
00207 void received (KProcess *proc, char *buffer, int buflen);
00208 void sent (KProcess *);
00209
00210 protected:
00211 virtual void virtual_hook( int id, void* data );
00212 private:
00213 KProcIOPrivate *d;
00214 };
00215
00216 #endif // KPROCIO_H_
00217