* Interface cleaned up by
* \author Angus Leeming
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*
* An instance of Class Forkedcall represents a single child process.
*
#ifndef FORKEDCALL_H
#define FORKEDCALL_H
-#include "LString.h"
-
#include <boost/shared_ptr.hpp>
-#include <boost/signals/signal2.hpp>
-#include <boost/function/function0.hpp>
+#include <boost/signal.hpp>
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
-#include <sys/types.h>
namespace lyx {
namespace support {
///
virtual ~ForkedProcess() {}
///
- virtual ForkedProcess * clone() const = 0;
+ virtual boost::shared_ptr<ForkedProcess> clone() const = 0;
/** A SignalType signal is can be emitted once the forked process
* has finished. It passes:
* we can return easily to C++ methods, rather than just globally
* accessible functions.
*/
- typedef boost::signal2<void, pid_t, int> SignalType;
+ typedef boost::signal<void(pid_t, int)> SignalType;
/** The signal is connected in the calling routine to the desired
* slot. We pass a shared_ptr rather than a reference to the signal
void setRetValue(int r) { retval_ = r; }
/// Returns the identifying command (for display in the GUI perhaps).
- string const & command() const { return command_; }
+ std::string const & command() const { return command_; }
/// is the process running ?
bool running() const;
void kill(int tolerance = 5);
protected:
- /** Wait for child process to finish.
- * Returns returncode from child.
- */
- int runBlocking();
- /** Do not wait for child process to finish.
+ /** Spawn the child process.
* Returns returncode from child.
*/
- int runNonBlocking();
+ int run(Starttype type);
/// Callback function
SignalTypePtr signal_;
/// identifying command (for display in the GUI perhaps).
- string command_;
+ std::string command_;
/// Process ID of child
pid_t pid_;
class Forkedcall : public ForkedProcess {
public:
///
- virtual ForkedProcess * clone() const {
- return new Forkedcall(*this);
+ virtual boost::shared_ptr<ForkedProcess> clone() const {
+ return boost::shared_ptr<ForkedProcess>(new Forkedcall(*this));
}
/** Start the child process.
* The other startscript command can be executed either blocking
* or non-blocking, but no signal will be emitted on finishing.
*/
- int startscript(Starttype, string const & what);
+ int startscript(Starttype, std::string const & what);
///
- int startscript(string const & what, SignalTypePtr);
+ int startscript(std::string const & what, SignalTypePtr);
private:
///