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 
00025 class KProcIOPrivate;
00026 class QTextCodec;
00027 
00050 class KProcIO : public KProcess
00051 {
00052   Q_OBJECT
00053 public:
00054   KProcIO ( QTextCodec *codec = 0 );
00055   
00056   ~KProcIO();
00057   
00072   bool start (RunMode  runmode = NotifyOnExit, bool includeStderr = false);
00073 
00080   bool writeStdin(const QString &line, bool appendnewline=TRUE);
00081 
00088   bool writeStdin(const QCString &line, bool appendnewline);
00089 
00095   bool writeStdin(const QByteArray &data);
00096 
00097   //I like fputs better -- it's the same as writeStdin
00098   //inline
00107   bool fputs (const QString &line, bool AppendNewLine=TRUE)
00108     { return writeStdin(line, AppendNewLine); }
00109 
00113   void closeWhenDone();
00114 
00136   int readln (QString &line, bool autoAck=true, bool *partial=0);
00137 
00148   int fgets (QString &line, bool autoAck=false)
00149     { return readln (line, autoAck); }
00150 
00154   void resetAll ();
00155 
00165   void ackRead ();
00166 
00173   void enableReadSignals (bool enable);
00174 
00175 signals:
00181   void readReady(KProcIO *pio);
00182 
00183 protected:
00184   QPtrList<QByteArray> outbuffer;
00185   QCString recvbuffer;
00186   QTextCodec *codec;
00187   int rbi;
00188   bool needreadsignal, readsignalon, writeready;
00189 
00190   void controlledEmission ();
00191 
00192 protected slots:
00193   void received (KProcess *proc, char *buffer, int buflen);
00194   void sent (KProcess *);
00195 
00196 protected:
00197   virtual void virtual_hook( int id, void* data );
00198 private:
00199   KProcIOPrivate *d;
00200 };
00201 
00202 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:47 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001