X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxserver.h;h=18623578d81294a1bb72d0cfbdfcf0cadff38dc4;hb=ce7c45bb437c44dae15f96148cb9b793ab0b895c;hp=3a3c180776645a62becc439539e62da77a7c8afd;hpb=2e218e32634b70bb3eda9ad1debe8fd089e544d4;p=lyx.git diff --git a/src/lyxserver.h b/src/lyxserver.h index 3a3c180776..18623578d8 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -1,25 +1,23 @@ // -*- C++ -*- -/* This file is part of -* ====================================================== -* -* LyX, The Document Processor -* -* Copyright 1995 Matthias Ettrich -* Copyright 1995-2001 The LyX Team. -* -* ====================================================== */ +/** + * \file lyxserver.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Lars Gullik Bjønnes + * \author Jean-Marc Lasgouttes + * + * Full author contact details are available in file CREDITS. + */ #ifndef LYXSERVER_H #define LYXSERVER_H -#ifdef __GNUG__ -#pragma interface -#endif +#include -#include "LString.h" -#include - +namespace lyx { + class LyXFunc; class LyXServer; @@ -38,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(); @@ -56,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(); @@ -79,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; @@ -94,7 +88,7 @@ private: bool ready; /// Base of pipename including path - string pipename; + std::string pipename; /// The client LyXServer * client; @@ -119,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() { @@ -133,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; /// @@ -149,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 ========================================== */