Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
ProcessBuilder.h
1 /*
2  * ProcessBuilder class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2006-12, IRIT UPS.
6  *
7  * OTAWA 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  * OTAWA 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 OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_SYS_PROCESS_BUILDER_H
22 #define ELM_SYS_PROCESS_BUILDER_H
23 
24 #include <elm/data/Vector.h>
25 #include <elm/sys/Path.h>
26 #include <elm/sys/System.h>
27 #include <elm/sys/SystemIO.h>
28 #include <elm/sys/Process.h>
29 
30 namespace elm { namespace sys {
31 
32 // ProcessBuilder class
34 public:
35  ProcessBuilder(sys::Path command);
36  void addArgument(string argument);
37  inline void add(string argument) { addArgument(argument); }
38  inline ProcessBuilder& operator+(string argument) { addArgument(argument); return *this; }
39  inline ProcessBuilder& operator+=(string argument) { addArgument(argument); return *this; }
40  void setInput(SystemInStream *_in);
41  void setOutput(SystemOutStream *_out);
42  void setError(SystemOutStream *_out);
43  void setNewSession(bool enabled);
44  Process *run(void);
45 
46 private:
47  Vector<string> args;
48  SystemInStream *in;
49  SystemOutStream *out, *err;
50  bool new_session;
51 };
52 
53 } } // elm::sys
54 
55 #endif // ELM_SYS_PROCESS_BUILDER_H
SystemInStream
elm::sys::Path
Definition: Path.h:33
elm::sys::ProcessBuilder::operator+=
ProcessBuilder & operator+=(string argument)
Definition: ProcessBuilder.h:39
elm::sys::ProcessBuilder::setNewSession
void setNewSession(bool enabled)
Definition: system_ProcessBuilder.cpp:86
SystemOutStream
elm::sys::ProcessBuilder::setError
void setError(SystemOutStream *_out)
Definition: system_ProcessBuilder.cpp:122
elm::sys::ProcessBuilder::add
void add(string argument)
Definition: ProcessBuilder.h:37
elm::sys::ProcessBuilder
Definition: ProcessBuilder.h:33
elm::sys::ProcessBuilder::run
Process * run(void)
Definition: system_ProcessBuilder.cpp:132
elm::sys::ProcessBuilder::ProcessBuilder
ProcessBuilder(sys::Path command)
Definition: system_ProcessBuilder.cpp:69
elm
Definition: adapter.h:26
elm::sys::Process
Definition: Process.h:27
elm::Vector< string >
elm::sys::ProcessBuilder::operator+
ProcessBuilder & operator+(string argument)
Definition: ProcessBuilder.h:38
elm::sys::ProcessBuilder::addArgument
void addArgument(string argument)
Definition: system_ProcessBuilder.cpp:95
elm::sys::ProcessBuilder::setOutput
void setOutput(SystemOutStream *_out)
Definition: system_ProcessBuilder.cpp:113
elm::sys::ProcessBuilder::setInput
void setInput(SystemInStream *_in)
Definition: system_ProcessBuilder.cpp:104