Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXProcess.h
1 /********************************************************************************
2 * *
3 * P r o c e s s S u p p o r t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXPROCESS_H
22 #define FXPROCESS_H
23 
24 namespace FX {
25 
26 class FXIODevice;
27 
28 
30 #if defined(WIN32)
31 typedef void* FXProcessID;
32 #else
33 typedef int FXProcessID;
34 #endif
35 
36 
38 class FXAPI FXProcess {
39 private:
40  FXProcessID pid; // Handle to process
41  FXIODevice *input; // Input stream
42  FXIODevice *output; // Output stream
43  FXIODevice *errors; // Errors stream
44 private:
45  FXProcess(const FXProcess&);
46  FXProcess &operator=(const FXProcess&);
47 public:
48 
50  FXProcess();
51 
53  FXProcessID id() const;
54 
56  FXbool start(const FXchar* exec,const FXchar *const *args,const FXchar *const *env=NULL);
57 
59  void setInputStream(FXIODevice* is){ input=is; }
60 
62  FXIODevice* getInputStream() const { return input; }
63 
65  void setOutputStream(FXIODevice* os){ output=os; }
66 
68  FXIODevice* getOutputStream() const { return output; }
69 
71  void setErrorStream(FXIODevice* es){ errors=es; }
72 
74  FXIODevice* getErrorStream() const { return errors; }
75 
77  static FXint current();
78 
80  static void exit(FXint code=0);
81 
83  FXbool suspend();
84 
86  FXbool resume();
87 
89  FXbool kill();
90 
92  FXbool wait();
93 
95  FXbool wait(FXint& code);
96 
98  ~FXProcess();
99  };
100 
101 }
102 
103 #endif

Copyright © 1997-2016 Jeroen van der Zijp