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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXProcess.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         P r o c e s s   S u p p o r t                         *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXPROCESS_H
00022 #define FXPROCESS_H
00023 
00024 namespace FX {
00025 
00027 
00028 class FXIODevice;
00029 
00030 
00032 #if defined(WIN32)
00033 typedef void* FXProcessID;
00034 #else
00035 typedef int   FXProcessID;
00036 #endif
00037 
00038 
00040 class FXAPI FXProcess {
00041 private:
00042   FXProcessID  pid;     // Handle to process
00043   FXIODevice  *input;   // Input stream
00044   FXIODevice  *output;  // Output stream
00045   FXIODevice  *errors;  // Errors stream
00046 private:
00047   FXProcess(const FXProcess&);
00048   FXProcess &operator=(const FXProcess&);
00049 public:
00050 
00052   FXProcess();
00053 
00055   FXProcessID id() const;
00056 
00058   FXbool start(const FXchar* exec,const FXchar *const *args,const FXchar *const *env=NULL);
00059 
00061   void setInputStream(FXIODevice* is){ input=is; }
00062 
00064   FXIODevice* getInputStream() const { return input; }
00065 
00067   void setOutputStream(FXIODevice* os){ output=os; }
00068 
00070   FXIODevice* getOutputStream() const { return output; }
00071 
00073   void setErrorStream(FXIODevice* es){ errors=es; }
00074 
00076   FXIODevice* getErrorStream() const { return errors; }
00077 
00079   static FXint current();
00080 
00082   static void exit(FXint code=0);
00083 
00085   FXbool suspend();
00086 
00088   FXbool resume();
00089 
00091   FXbool kill();
00092 
00094   FXbool wait();
00095 
00097   FXbool wait(FXint& code);
00098 
00100  ~FXProcess();
00101   };
00102 
00103 }
00104 
00105 #endif

Copyright © 1997-2011 Jeroen van der Zijp