KProcIO Class Reference
KProcIO A slightly simpler interface to KProcess. More...
#include <kprocio.h>
Inheritance diagram for KProcIO:


Signals | |
void | readReady (KProcIO *pio) |
Public Member Functions | |
KProcIO (QTextCodec *codec=0) | |
~KProcIO () | |
void | setComm (Communication comm) |
bool | start (RunMode runmode=NotifyOnExit, bool includeStderr=false) |
bool | writeStdin (const QString &line, bool appendnewline=true) |
bool | writeStdin (const QCString &line, bool appendnewline) |
bool | writeStdin (const QByteArray &data) |
KDE_DEPRECATED bool | fputs (const QString &line, bool AppendNewLine=true) |
void | closeWhenDone () |
int | readln (QString &line, bool autoAck=true, bool *partial=0) |
KDE_DEPRECATED int | fgets (QString &line, bool autoAck=false) |
void | resetAll () |
void | ackRead () |
void | enableReadSignals (bool enable) |
Protected Slots | |
void | received (KProcess *proc, char *buffer, int buflen) |
void | sent (KProcess *) |
Protected Member Functions | |
void | controlledEmission () |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
QPtrList< QByteArray > | outbuffer |
QCString | recvbuffer |
QTextCodec * | codec |
int | rbi |
bool | needreadsignal |
bool | readsignalon |
bool | writeready |
Detailed Description
KProcIO A slightly simpler interface to KProcess.This class provides a slightly simpler interface to the communication functions provided by KProcess. The simplifications are:
- The buffer for a write is copied to an internal KProcIO buffer and maintained/freed appropriately. There is no need to be concerned with wroteStdin() signals _at_all_.
- readln() reads a line of data and buffers any leftovers.
- Conversion from/to unicode.
Aside from these, and the fact that start() takes different parameters, use this class just like KProcess.
- Author:
- David Sweet
Definition at line 50 of file kprocio.h.
Constructor & Destructor Documentation
|
Constructor.
Definition at line 38 of file kprocio.cpp. References endl(), and KProcIO(). Referenced by KProcIO(). |
|
Destructor.
Definition at line 55 of file kprocio.cpp. |
Member Function Documentation
|
Sets the communication mode to be passed to KProcess::start() by start(). The default communication mode is KProcess::All. You probably want to use this function in conjunction with KProcess::setUsePty().
Definition at line 83 of file kprocio.cpp. References setComm(). Referenced by setComm(). |
|
Starts the process. It will fail in the following cases:
Definition at line 88 of file kprocio.cpp. References start(). Referenced by start(). |
|
Writes text to stdin of the process.
Definition at line 105 of file kprocio.cpp. References writeStdin(). Referenced by writeStdin(). |
|
Writes text to stdin of the process.
Definition at line 110 of file kprocio.cpp. References writeStdin(). |
|
Writes data to stdin of the process.
Definition at line 139 of file kprocio.cpp. References writeStdin(). |
|
This function just calls writeStdin().
|
|
Closes stdin after all data has been send.
Definition at line 154 of file kprocio.cpp. References KProcess::closeStdin(). |
|
Reads a line of text (up to and including '\n'). Use readln() in response to a readReady() signal. You may use it multiple times if more than one line of data is available. Be sure to use ackRead() when you have finished processing the readReady() signal. This informs KProcIO that you are ready for another readReady() signal. readln() never blocks. autoAck==true makes these functions call ackRead() for you.
Definition at line 225 of file kprocio.cpp. References readln(). Referenced by readln(). |
|
This function calls readln().
|
|
Reset the class. Doesn't kill the process. Definition at line 61 of file kprocio.cpp. References KProcess::clearArguments(), and KProcess::isRunning(). |
|
Call this after you have finished processing a readReady() signal. This call need not be made in the slot that was signalled by readReady(). You won't receive any more readReady() signals until you acknowledge with ackRead(). This prevents your slot from being reentered while you are still processing the current data. If this doesn't matter, then call ackRead() right away in your readReady()-processing slot. Definition at line 196 of file kprocio.cpp. |
|
Turns readReady() signals on and off. You can turn this off at will and not worry about losing any data. (as long as you turn it back on at some point...)
Definition at line 217 of file kprocio.cpp. References enableReadSignals(), and readReady(). Referenced by enableReadSignals(). |
|
Emitted when the process is ready for reading.
Referenced by enableReadSignals(). |
The documentation for this class was generated from the following files: