00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef QCHILDPROCESS_H
00024 #define QCHILDPROCESS_H
00025 #include "QIODeviceS.h"
00026 #include "FXString.h"
00027
00028 namespace FX {
00029
00074 struct QChildProcessPrivate;
00075 class FXAPIR QChildProcess : public QIODeviceS
00076 {
00077 QChildProcessPrivate *p;
00078 QChildProcess(const QChildProcess &);
00079 QChildProcess &operator=(const QChildProcess &);
00080 virtual FXDLLLOCAL void *int_getOSHandle() const;
00081 FXDLLLOCAL void int_killChildI(bool);
00082 public:
00084 enum ReadChannel
00085 {
00086 StdOut=1,
00087 StdErr=2,
00088 Combined=3
00089 };
00090 public:
00091 QChildProcess();
00093 QChildProcess(const FXString &command, const FXString &args=FXString::nullStr(), ReadChannel channel=Combined);
00094 ~QChildProcess();
00095
00097 const FXString &command() const;
00099 void setCommand(const FXString &command);
00101 FXString arguments() const;
00103 void setArguments(const FXString &args);
00105 FXString workingDir() const;
00107 void setWorkingDir(const FXString &dir);
00109 ReadChannel readChannel() const throw();
00111 void setReadChannel(ReadChannel channel);
00112
00114 FXlong returnCode() const throw();
00116 void detach();
00118 bool waitForExit(FXuint waitfor=FXINFINITE);
00120 bool terminate();
00121 private:
00123 bool create(FXuint mode=IO_ReadWrite);
00124 public:
00126 bool open(FXuint mode=IO_ReadWrite);
00128 void close();
00130 void flush();
00131
00133 FXfval size() const;
00134
00143 FXuval readBlock(char *data, FXuval maxlen);
00151 FXuval writeBlock(const char *data, FXuval maxlen);
00152
00154 int ungetch(int);
00155 };
00156
00157 }
00158
00159 #endif