[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klffilterprocess.h
1/***************************************************************************
2 * file klffilterprocess.h
3 * This file is part of the KLatexFormula Project.
4 * Copyright (C) 2011 by Philippe Faist
5 * philippe.faist at bluewin.ch
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22/* $Id$ */
23
24
25#ifndef KLFFILTERPROCESS_H
26#define KLFFILTERPROCESS_H
27
28
29#include <klfdefs.h>
30#include <klfblockprocess.h>
31#include <klfbackend.h>
32
33
34#define KLFFP_NOERR 0
35#define KLFFP_NOSTART 1
36#define KLFFP_NOEXIT 2
37#define KLFFP_NOSUCCESSEXIT 3
38#define KLFFP_NODATA 4
39#define KLFFP_DATAREADFAIL 5
40#define KLFFP_PAST_LAST_VALUE 6
41
42
43
44struct KLFFilterProcessPrivate;
45class KLFFilterProcessBlockProcess;
46
47class KLF_EXPORT KLFFilterProcess
48{
49public:
50 KLFFilterProcess(const QString& pTitle = QString(), const KLFBackend::klfSettings *settings = NULL,
51 const QString& rundir = QString());
52 KLFFilterProcess(const QString& pTitle, const KLFBackend::klfSettings *settings,
53 const QString& rundir, bool inheritProcessEnvironment);
54 virtual ~KLFFilterProcess();
55
56
57 QString progTitle() const;
58 void setProgTitle(const QString& title);
59
60 QString programCwd() const;
61 void setProgramCwd(const QString& cwd);
62
63 QStringList execEnviron() const;
64 void setExecEnviron(const QStringList& env);
65 void addExecEnviron(const QStringList& env);
66
67 QStringList argv() const;
68 void setArgv(const QStringList& argv);
69 void addArgv(const QStringList& argv);
70 void addArgv(const QString& argv);
71
72 bool outputStdout() const;
74 void setOutputStdout(bool on);
75
76 bool outputStderr() const;
79 void setOutputStderr(bool on);
80
82 void collectStdoutTo(QByteArray * stdoutstore);
84 void collectStderrTo(QByteArray * stderrstore);
85
87 bool processAppEvents();
91 void setProcessAppEvents(bool processEvents);
92
93
95 virtual int exitStatus() const;
97 virtual int exitCode() const;
98
100 virtual int resultStatus() const;
102 virtual QString resultErrorString() const;
103
104
105 bool run(const QString& outFileName, QByteArray *outdata)
106 {
107 return run(QByteArray(), outFileName, outdata);
108 }
109
110 bool run(const QByteArray& indata, const QString& outFileName, QByteArray *outdata)
111 {
112 QMap<QString,QByteArray*> fout; fout[outFileName] = outdata;
113 return do_run(indata, fout);
114 }
115
116 bool run(const QMap<QString, QByteArray*> outdata)
117 {
118 return do_run(QByteArray(), outdata);
119 }
120
121 bool run(const QByteArray& indata = QByteArray())
122 {
123 return do_run(indata, QMap<QString, QByteArray*>());
124 }
125
139 bool run(const QByteArray& indata, const QMap<QString, QByteArray*> outdatalist)
140 {
141 return do_run(indata, outdatalist);
142 }
143
144protected:
145
146 friend class KLFFilterProcessBlockProcess;
147 virtual QMap<QString,QString> interpreters() const;
148
157 virtual bool do_run(const QByteArray& indata, const QMap<QString, QByteArray*> outdatalist);
158
164 QByteArray collectedStdout() const;
170 QByteArray collectedStderr() const;
171
172private:
174};
175
176
177
178
179
180
181
182
183#endif
virtual int exitCode() const
void collectStderrTo(QByteArray *stderrstore)
virtual bool do_run(const QByteArray &indata, const QMap< QString, QByteArray * > outdatalist)
Actually run the process.
void setOutputStderr(bool on)
virtual QString resultErrorString() const
virtual int resultStatus() const
bool run(const QByteArray &indata, const QMap< QString, QByteArray * > outdatalist)
void collectStdoutTo(QByteArray *stdoutstore)
virtual int exitStatus() const
void setProcessAppEvents(bool processEvents)
void setOutputStdout(bool on)
Definition of class KLFBackend.
Defines the KLFBlockProcess class.
#define KLF_DECLARE_PRIVATE(ClassName)
#define KLF_EXPORT
General settings for KLFBackend::getLatexFormula()
Definition klfbackend.h:219

Generated by doxygen 1.13.2