X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxserver.h;h=18623578d81294a1bb72d0cfbdfcf0cadff38dc4;hb=8765ab59cdddad67284007813ef25934ea0042ce;hp=636ef2855641bb5a2be2a3d4021f874440495b09;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/lyxserver.h b/src/lyxserver.h index 636ef28556..18623578d8 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -13,10 +13,11 @@ #ifndef LYXSERVER_H #define LYXSERVER_H -#include "LString.h" - #include + +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 ========================================== */