KLFBlockProcess Class Reference

A QProcess subclass for code-blocking process execution. More...

#include <klfblockprocess.h>

List of all members.

Public Slots

bool startProcess (QStringList cmd, QByteArray stdindata, QStringList env=QStringList())
bool startProcess (QStringList cmd, QStringList env=QStringList())
QString readStderrString ()
QString readStdoutString ()

Public Member Functions

 KLFBlockProcess (QObject *parent=0)
 ~KLFBlockProcess ()
QByteArray getAllStderr ()
QByteArray getAllStdout ()
bool normalExit () const
int exitStatus () const


Detailed Description

A QProcess subclass for code-blocking process execution.

A Code-blocking (but not GUI-blocking) process executor

Use for example like:

   KLFBlockProcess proc;
   QStringList args;
   args << "ls" << "/dev";
   proc.startProcess(args);
   QString alldevices = proc.readStdoutString();

This class provides functionality for passing data to STDIN and getting data from STDOUT and STDERR afterwards.

Author:
Philippe Faist <philippe.faist@bluewin.ch>

Definition at line 56 of file klfblockprocess.h.


Constructor & Destructor Documentation

KLFBlockProcess::KLFBlockProcess ( QObject *  parent = 0  ) 

Normal constructor, like QProcess constructor

Definition at line 29 of file klfblockprocess.cpp.

KLFBlockProcess::~KLFBlockProcess (  ) 

Normal destructor

Definition at line 40 of file klfblockprocess.cpp.


Member Function Documentation

QByteArray KLFBlockProcess::getAllStderr (  ) 

Returns all standard error output as a QByteArray. This function is to standardize the readStderr() and readAllStandardError() functions in QT 3 or QT 4 respectively

Definition at line 67 of file klfblockprocess.h.

Referenced by readStderrString().

QByteArray KLFBlockProcess::getAllStdout (  ) 

Returns all standard output as a QByteArray. This function is to standardize the readStdout() and readAllStandardOutput() functions in QT 3 or QT 4 respectively

Definition at line 77 of file klfblockprocess.h.

Referenced by readStdoutString().

bool KLFBlockProcess::normalExit (  )  const

Tweak here to change new QT4 api to old QT3 api

Definition at line 87 of file klfblockprocess.h.

Referenced by KLFBackend::getLatexFormula().

int KLFBlockProcess::exitStatus (  )  const

Tweak here to change new QT4 api to old QT3 api

Definition at line 91 of file klfblockprocess.h.

Referenced by KLFBackend::getLatexFormula().

bool KLFBlockProcess::startProcess ( QStringList  cmd,
QByteArray  stdindata,
QStringList  env = QStringList() 
) [slot]

Starts cmd (which is a list of arguments, the first being the program itself) and blocks until process stopped. The QT event loop is updated regularly so that the GUI doesn't freeze.

Read result with QProcess::readStdout() and QProcess::readStderr(), get process exit info with QProcess::normalExit() and QProcess::exitStatus().

Returns:
TRUE upon success, FALSE upon failure.

Definition at line 66 of file klfblockprocess.cpp.

Referenced by KLFBackend::getLatexFormula(), and startProcess().

bool KLFBlockProcess::startProcess ( QStringList  cmd,
QStringList  env = QStringList() 
) [slot]

Convenient function to be used in the case where program doesn't expect stdin data or if you chose to directly close stdin without writing anything to it.

Definition at line 61 of file klfblockprocess.cpp.

References startProcess().

QString KLFBlockProcess::readStderrString (  )  [slot]

Same as getAllStderr(), except result is returned here as QString.

Definition at line 122 of file klfblockprocess.h.

References getAllStderr().

Referenced by KLFBackend::getLatexFormula().

QString KLFBlockProcess::readStdoutString (  )  [slot]

Same as getAllStdout(), except result is returned here as QString.

Definition at line 126 of file klfblockprocess.h.

References getAllStdout().

Referenced by KLFBackend::getLatexFormula().


The documentation for this class was generated from the following files:
Generated on Mon May 4 01:27:08 2009 for KLFBackend by  doxygen 1.5.3