]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcall.h
hopefully fix tex2lyx linking.
[lyx.git] / src / support / forkedcall.h
index 8e58485d18e4c8f66c0aed5af98aaee31cce7e52..8d0c9fa443a50ab94cfb1d7c1d4f5a667d14ec98 100644 (file)
 #ifndef FORKEDCALL_H
 #define FORKEDCALL_H
 
-#include "support/std_string.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 {
@@ -52,7 +52,7 @@ public:
        ///
        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:
@@ -63,7 +63,7 @@ public:
         *  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
@@ -95,7 +95,7 @@ public:
        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;
@@ -109,20 +109,16 @@ public:
        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_;
@@ -141,8 +137,8 @@ private:
 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.
@@ -157,10 +153,10 @@ public:
         *  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:
        ///