// -*- 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 <boost/signals/trackable.hpp>
-#include "LString.h"
-#include <boost/signals/trackable.hpp>
-
+namespace lyx {
+
class LyXFunc;
class LyXServer;
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();
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();
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;
bool ready;
/// Base of pipename including path
- string pipename;
+ std::string pipename;
/// The client
LyXServer * client;
// 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() {
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;
///
LyXComm pipes;
};
+/// Implementation is in lyx_main.C
+extern LyXServer & theLyXServer();
+
#endif /* _LYXSERVER_H_ */
+
+} // namespace lyx
+
/* === End of File: lyxserver.h ========================================== */