kdecore Library API Documentation

kprocio.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1997 David Sweet <dsweet@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 #ifndef KPROCIO_H_
00019 #define KPROCIO_H_
00020 
00021 #include <qstring.h>
00022 #include <kprocess.h>
00023 #include <qstrlist.h>
00024 #include "kdemacros.h"
00025 
00026 class KProcIOPrivate;
00027 class QTextCodec;
00028 
00051 class KProcIO : public KProcess
00052 {
00053   Q_OBJECT
00054 
00055 public:
00059   KProcIO ( QTextCodec *codec = 0 );
00060 
00064   ~KProcIO();
00065 
00073   void setComm (Communication comm);
00074 
00089   bool start (RunMode  runmode = NotifyOnExit, bool includeStderr = false);
00090 
00097   bool writeStdin(const QString &line, bool appendnewline=true);
00098 
00105   bool writeStdin(const QCString &line, bool appendnewline);
00106 
00112   bool writeStdin(const QByteArray &data);
00113 
00114   //I like fputs better -- it's the same as writeStdin
00115   //inline
00124   KDE_DEPRECATED bool fputs (const QString &line, bool AppendNewLine=true)
00125     { return writeStdin(line, AppendNewLine); }
00126 
00130   void closeWhenDone();
00131 
00153   int readln (QString &line, bool autoAck=true, bool *partial=0);
00154 
00163   KDE_DEPRECATED int fgets (QString &line, bool autoAck=false)
00164     { return readln (line, autoAck); }
00165 
00169   void resetAll ();
00170 
00180   void ackRead ();
00181 
00188   void enableReadSignals (bool enable);
00189 
00190 signals:
00196   void readReady(KProcIO *pio);
00197 
00198 protected:
00199   QPtrList<QByteArray> outbuffer;
00200   QCString recvbuffer;
00201   QTextCodec *codec;
00202   int rbi;
00203   bool needreadsignal, readsignalon, writeready;
00204 
00205   void controlledEmission ();
00206 
00207 protected slots:
00208   void received (KProcess *proc, char *buffer, int buflen);
00209   void sent (KProcess *);
00210 
00211 protected:
00212   virtual void virtual_hook( int id, void* data );
00213 private:
00214   KProcIOPrivate *d;
00215 };
00216 
00217 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:43:31 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003