]> git.lyx.org Git - lyx.git/blobdiff - src/support/forkedcall.h
hopefully fix tex2lyx linking.
[lyx.git] / src / support / forkedcall.h
index b1bfa2865be4a625718117c9aab7d5f73d6d10c9..8d0c9fa443a50ab94cfb1d7c1d4f5a667d14ec98 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 /**
- *  \file forkedcall.h
+ * \file forkedcall.h
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
@@ -9,7 +9,7 @@
  * 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 {
 
 class ForkedProcess {
 public:
@@ -49,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:
@@ -60,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
@@ -92,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;
@@ -106,20 +109,16 @@ public:
        void kill(int tolerance = 5);
 
 protected:
-       /** Wait for child process to finish.
+       /** Spawn the child process.
         *  Returns returncode from child.
         */
-       int runBlocking();
-       /** Do not wait for child process to finish.
-        *  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_;
@@ -138,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.
@@ -154,14 +153,17 @@ 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:
        ///
        virtual int generateChild();
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // FORKEDCALL_H