Public Member Functions | |
KLFFilterProcess (const QString &pTitle=QString(), const KLFBackend::klfSettings *settings=NULL, const QString &rundir=QString()) | |
KLFFilterProcess (const QString &pTitle, const KLFBackend::klfSettings *settings, const QString &rundir, bool inheritProcessEnvironment) | |
QString | progTitle () const |
void | setProgTitle (const QString &title) |
QString | programCwd () const |
void | setProgramCwd (const QString &cwd) |
QStringList | execEnviron () const |
void | setExecEnviron (const QStringList &env) |
void | addExecEnviron (const QStringList &env) |
QStringList | argv () const |
void | setArgv (const QStringList &argv) |
void | addArgv (const QStringList &argv) |
void | addArgv (const QString &argv) |
bool | outputStdout () const |
void | setOutputStdout (bool on) |
bool | outputStderr () const |
void | setOutputStderr (bool on) |
void | collectStdoutTo (QByteArray *stdoutstore) |
void | collectStderrTo (QByteArray *stderrstore) |
bool | processAppEvents () |
void | setProcessAppEvents (bool processEvents) |
virtual int | exitStatus () const |
virtual int | exitCode () const |
virtual int | resultStatus () const |
virtual QString | resultErrorString () const |
bool | run (const QString &outFileName, QByteArray *outdata) |
bool | run (const QByteArray &indata, const QString &outFileName, QByteArray *outdata) |
bool | run (const QMap< QString, QByteArray * > outdata) |
bool | run (const QByteArray &indata=QByteArray()) |
bool | run (const QByteArray &indata, const QMap< QString, QByteArray * > outdatalist) |
Protected Member Functions | |
virtual QMap< QString, QString > | interpreters () const |
virtual bool | do_run (const QByteArray &indata, const QMap< QString, QByteArray * > outdatalist) |
Actually run the process. | |
QByteArray | collectedStdout () const |
The collected stdout data of the process that just ran. | |
QByteArray | collectedStderr () const |
The collected stderr data of the process that just ran. | |
Definition at line 47 of file klffilterprocess.h.
KLFFilterProcess::KLFFilterProcess | ( | const QString & | pTitle = QString() , |
const KLFBackend::klfSettings * | settings = NULL , |
||
const QString & | rundir = QString() |
||
) |
Definition at line 135 of file klffilterprocess.cpp.
KLFFilterProcess::KLFFilterProcess | ( | const QString & | pTitle, |
const KLFBackend::klfSettings * | settings, | ||
const QString & | rundir, | ||
bool | inheritProcessEnvironment | ||
) |
Definition at line 142 of file klffilterprocess.cpp.
|
virtual |
Definition at line 191 of file klffilterprocess.cpp.
void KLFFilterProcess::addArgv | ( | const QString & | argv | ) |
Definition at line 243 of file klffilterprocess.cpp.
void KLFFilterProcess::addArgv | ( | const QStringList & | argv | ) |
Definition at line 239 of file klffilterprocess.cpp.
void KLFFilterProcess::addExecEnviron | ( | const QStringList & | env | ) |
Definition at line 225 of file klffilterprocess.cpp.
QStringList KLFFilterProcess::argv | ( | ) | const |
Definition at line 231 of file klffilterprocess.cpp.
|
protected |
The collected stderr data of the process that just ran.
Convenience method for subclasses. Stderr data collection must have been enabled (with setOutputStderr() and collectStderrTo()).
Definition at line 435 of file klffilterprocess.cpp.
Referenced by KLFUserScriptFilterProcess::do_run().
|
protected |
The collected stdout data of the process that just ran.
Convenience method for subclasses. Stdout data collection must have been enabled (with setOutputStdout() and collectStdoutTo()).
Definition at line 428 of file klffilterprocess.cpp.
Referenced by KLFUserScriptFilterProcess::do_run().
void KLFFilterProcess::collectStderrTo | ( | QByteArray * | stderrstore | ) |
Set a QByteArray where all stderr data will be stored
Definition at line 271 of file klffilterprocess.cpp.
References setOutputStderr().
Referenced by KLFBackend::getLatexFormula().
void KLFFilterProcess::collectStdoutTo | ( | QByteArray * | stdoutstore | ) |
Set a QByteArray where all stdout data will be stored
Definition at line 266 of file klffilterprocess.cpp.
References setOutputStdout().
Referenced by KLFBackend::getLatexFormula().
|
protectedvirtual |
Actually run the process.
Each run() overload above internally just redirects to this function.
Subclasses may reimplement if they want to do some bookkeeping, cleaning up, keeping a log, etc.
Reimplemented in KLFUserScriptFilterProcess.
Definition at line 310 of file klffilterprocess.cpp.
References QString::arg(), QMap::begin(), QMap::end(), QFile::exists(), QByteArray::isEmpty(), QString::isEmpty(), QMap::key(), KLF_ASSERT_CONDITION, KLF_ASSERT_NOT_NULL, KLF_DEBUG_BLOCK, KLF_FUNC_NAME, klfDbg, QFile::open(), QIODevice::readAll(), QByteArray::size(), QObject::tr(), and QMap::value().
Referenced by KLFUserScriptFilterProcess::do_run().
QStringList KLFFilterProcess::execEnviron | ( | ) | const |
Definition at line 216 of file klffilterprocess.cpp.
|
virtual |
After run(), this is set to the exit code of the process. See QProcess::exitCode()
Definition at line 291 of file klffilterprocess.cpp.
|
virtual |
After run(), this is set to the exit status of the process. See QProcess::exitStatus()
Definition at line 287 of file klffilterprocess.cpp.
Definition at line 305 of file klffilterprocess.cpp.
bool KLFFilterProcess::outputStderr | ( | ) | const |
Definition at line 257 of file klffilterprocess.cpp.
bool KLFFilterProcess::outputStdout | ( | ) | const |
Definition at line 248 of file klffilterprocess.cpp.
bool KLFFilterProcess::processAppEvents | ( | ) |
Definition at line 277 of file klffilterprocess.cpp.
QString KLFFilterProcess::programCwd | ( | ) | const |
Definition at line 207 of file klffilterprocess.cpp.
QString KLFFilterProcess::progTitle | ( | ) | const |
Definition at line 198 of file klffilterprocess.cpp.
|
virtual |
An explicit error string in case the resultStatus() indicated an error.
Definition at line 300 of file klffilterprocess.cpp.
Referenced by KLFUserScriptFilterProcess::do_run(), and KLFBackend::getLatexFormula().
|
virtual |
This is one of the KLFFP_* define's, such as KLFFP_NOSTART, or KLFFP_NOERR if all OK.
Definition at line 296 of file klffilterprocess.cpp.
Referenced by KLFBackend::getLatexFormula().
|
inline |
indata | a QByteArray to write into the program's standard input |
outdatalist | a QMap with keys being files that are created by the program. These files are read and their contents stored in the QByteArray's pointed by the corresponding pointer. |
resError | the klfOutput object is initialized to the corresponding error if an error occurred. |
An empty file name in the list means to collect the standard output.
Definition at line 139 of file klffilterprocess.h.
|
inline |
Definition at line 110 of file klffilterprocess.h.
|
inline |
Definition at line 121 of file klffilterprocess.h.
|
inline |
Definition at line 116 of file klffilterprocess.h.
|
inline |
Definition at line 105 of file klffilterprocess.h.
void KLFFilterProcess::setArgv | ( | const QStringList & | argv | ) |
Definition at line 235 of file klffilterprocess.cpp.
void KLFFilterProcess::setExecEnviron | ( | const QStringList & | env | ) |
Definition at line 220 of file klffilterprocess.cpp.
void KLFFilterProcess::setOutputStderr | ( | bool | on | ) |
Set this to true to also read stderr as part of the output. If false (the default), stderr output is only reported in the error message in case nothing came out on stdout.
Definition at line 261 of file klffilterprocess.cpp.
Referenced by collectStderrTo().
void KLFFilterProcess::setOutputStdout | ( | bool | on | ) |
Set this to false to ignore output on stdout of the program.
Definition at line 252 of file klffilterprocess.cpp.
Referenced by collectStdoutTo().
void KLFFilterProcess::setProcessAppEvents | ( | bool | processEvents | ) |
specify whether or not to call regularly qApp->processEvents() while executing. This will prevent the GUI to freeze. Enabled is the default. However you can choose to disable this behavior by passing FALSE here, e.g. if you're not in the GUI thread.
Definition at line 282 of file klffilterprocess.cpp.
Referenced by KLFBackend::getLatexFormula().
void KLFFilterProcess::setProgramCwd | ( | const QString & | cwd | ) |
Definition at line 211 of file klffilterprocess.cpp.
void KLFFilterProcess::setProgTitle | ( | const QString & | title | ) |
Definition at line 202 of file klffilterprocess.cpp.