[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: klffilterprocess.h 994 2017-01-10 01:09:40Z phfaist $ */
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 
44 struct KLFFilterProcessPrivate;
45 class KLFFilterProcessBlockProcess;
46 
48 {
49 public:
50  KLFFilterProcess(const QString& pTitle = QString(), const KLFBackend::klfSettings *settings = NULL,
51  const QString& rundir = QString());
52  virtual ~KLFFilterProcess();
53 
54 
55  QString progTitle() const;
56  void setProgTitle(const QString& title);
57 
58  QString programCwd() const;
59  void setProgramCwd(const QString& cwd);
60 
61  QStringList execEnviron() const;
62  void setExecEnviron(const QStringList& env);
63  void addExecEnviron(const QStringList& env);
64 
65  QStringList argv() const;
66  void setArgv(const QStringList& argv);
67  void addArgv(const QStringList& argv);
68  void addArgv(const QString& argv);
69 
70  bool outputStdout() const;
72  void setOutputStdout(bool on);
73 
74  bool outputStderr() const;
77  void setOutputStderr(bool on);
78 
80  void collectStdoutTo(QByteArray * stdoutstore);
82  void collectStderrTo(QByteArray * stderrstore);
83 
85  bool processAppEvents();
89  void setProcessAppEvents(bool processEvents);
90 
91 
93  virtual int exitStatus() const;
95  virtual int exitCode() const;
96 
98  virtual int resultStatus() const;
100  virtual QString resultErrorString() const;
101 
102 
103  bool run(const QString& outFileName, QByteArray *outdata)
104  {
105  return run(QByteArray(), outFileName, outdata);
106  }
107 
108  bool run(const QByteArray& indata, const QString& outFileName, QByteArray *outdata)
109  {
110  QMap<QString,QByteArray*> fout; fout[outFileName] = outdata;
111  return do_run(indata, fout);
112  }
113 
114  bool run(const QMap<QString, QByteArray*> outdata)
115  {
116  return do_run(QByteArray(), outdata);
117  }
118 
119  bool run(const QByteArray& indata = QByteArray())
120  {
121  return do_run(indata, QMap<QString, QByteArray*>());
122  }
123 
137  bool run(const QByteArray& indata, const QMap<QString, QByteArray*> outdatalist)
138  {
139  return do_run(indata, outdatalist);
140  }
141 
142 
143 protected:
144 
145  friend class KLFFilterProcessBlockProcess;
146  virtual QMap<QString,QString> interpreters() const;
147 
156  virtual bool do_run(const QByteArray& indata, const QMap<QString, QByteArray*> outdatalist);
157 
163  QByteArray collectedStdout() const;
169  QByteArray collectedStderr() const;
170 
171 private:
173 };
174 
175 
176 
177 
178 
179 
180 
181 
182 #endif
Defines the KLFBlockProcess class.
bool run(const QByteArray &indata, const QMap< QString, QByteArray *> outdatalist)
#define KLF_EXPORT
#define KLF_DECLARE_PRIVATE(ClassName)
Definition of class KLFBackend.
General settings for KLFBackend::getLatexFormula()
Definition: klfbackend.h:218

Generated by doxygen 1.8.13