]> git.lyx.org Git - lyx.git/blobdiff - src/lyxserver.h
Small formatting and comment cleanup.
[lyx.git] / src / lyxserver.h
index 636ef2855641bb5a2be2a3d4021f874440495b09..18623578d81294a1bb72d0cfbdfcf0cadff38dc4 100644 (file)
 #ifndef LYXSERVER_H
 #define LYXSERVER_H
 
-#include "LString.h"
-
 #include <boost/signals/trackable.hpp>
 
+
+namespace lyx {
+
 class LyXFunc;
 class LyXServer;
 
@@ -35,10 +36,10 @@ public:
          This is one of the small things that would have been a lot
          cleaner with a Signal/Slot thing.
         */
-       typedef void (*ClientCallbackfct)(LyXServer *, string const &);
+       typedef void (*ClientCallbackfct)(LyXServer *, std::string const &);
 
        /// Construct with pipe-basename and callback to receive messages
-       LyXComm(string const & pip, LyXServer * cli, ClientCallbackfct ccb = 0)
+       LyXComm(std::string const & pip, LyXServer * cli, ClientCallbackfct ccb = 0)
                : pipename(pip), client(cli), clientcb(ccb) {
                ready = false;
                openConnection();
@@ -53,21 +54,17 @@ public:
        void emergencyCleanup();
 
        /// Send message
-       void send(string const &);
+       void send(std::string const &);
 
        /// asynch ready-to-be-read notification
        void read_ready();
 
 private:
        /// the filename of the in pipe
-       string const inPipeName() {
-               return pipename + ".in";
-       }
+       std::string const inPipeName() const;
 
        /// the filename of the out pipe
-       string const outPipeName() {
-               return pipename + ".out";
-       }
+       std::string const outPipeName() const;
 
        /// Open pipes
        void openConnection();
@@ -76,10 +73,10 @@ private:
        void closeConnection();
 
        /// start a pipe
-       int startPipe(string const &, bool);
+       int startPipe(std::string const &, bool);
 
        /// finish a pipe
-       void endPipe(int &, string const &, bool);
+       void endPipe(int &, std::string const &, bool);
 
        /// This is -1 if not open
        int infd;
@@ -91,7 +88,7 @@ private:
        bool ready;
 
        /// Base of pipename including path
-       string pipename;
+       std::string pipename;
 
        /// The client
        LyXServer * client;
@@ -116,12 +113,12 @@ public:
        // lyxserver is using a buffer that is being edited with a bufferview.
        // With a common buffer list this is not a problem, maybe. (Alejandro)
        ///
-       LyXServer(LyXFunc * f, string const & pip)
+       LyXServer(LyXFunc * f, std::string const & pip)
                : numclients(0), func(f), pipes(pip, (this), callback) {}
        ///
        ~LyXServer();
        ///
-       void notifyClient(string const &);
+       void notifyClient(std::string const &);
 
        /// whilst crashing etc.
        void emergencyCleanup() {
@@ -130,14 +127,14 @@ public:
 
 private:
        ///
-       static void callback(LyXServer *, string const & msg);
+       static void callback(LyXServer *, std::string const & msg);
        /// Names and number of current clients
        enum {
                ///
                MAX_CLIENTS = 10
        };
        ///
-       string clients[MAX_CLIENTS];
+       std::string clients[MAX_CLIENTS];
        ///
        int numclients;
        ///
@@ -146,6 +143,12 @@ private:
        LyXComm pipes;
 };
 
+/// Implementation is in lyx_main.C
+extern LyXServer & theLyXServer();
+
+
+} // namespace lyx
+
 #endif /* _LYXSERVER_H_ */
 
 /* === End of File: lyxserver.h ========================================== */