Sushant Raikar wrote: More or less cosmetical comments, don't have time to test or go into the logic of the code. Pavel
> +void BufferView::Private::send(FuncRequest const & cmd, SocketConnection > *p_excl_conn) { > + > + LFUNHolder lh; > + //just a random number for testing > + lh.attach_version(10); > + lh.attach_LFUN(cmd); what this version means? why it's not in .h? > + printf("Done\n"); use lyxerr instead of printf, don't pull stdio.h. used on more places. > + connect(&d->timer_, SIGNAL(timeout()), this, SLOT(periodicTimer())); > + d->timer_.setInterval(500); > + d->p_conn_ = 0; > + d->client_conn_ = true; indentation wrong. > + BufferView *p_bv = new BufferView(buffer()); > + /// @TODO Just a random size in the hope that we skip some crash > + p_bv->resize(320, 200); looks fishy. what exactly you are trying to achieve? > -void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) > +void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr,bool > enable_send) whitespace missing. would it make sense to add the bool into funcrequest? > diff --git a/src/BufferView.h b/src/BufferView.h > index a94ddfd..867bae4 100644 > --- a/src/BufferView.h > +++ b/src/BufferView.h > @@ -20,6 +20,8 @@ > > #include "support/strfwd.h" > #include "support/types.h" > +#include "support/Socket.h" > +#include <QTimer> i don't know whether there is general consensus how much should we pull qt dependencies into core. > diff --git a/src/CursorSlice.h b/src/CursorSlice.h > index 01634bd..a6d6408 100644 > --- a/src/CursorSlice.h > +++ b/src/CursorSlice.h > @@ -124,6 +124,10 @@ public: > > /// write some debug information to \p os > friend std::ostream & operator<<(std::ostream &, CursorSlice const &); > + > + friend std::istream & > + operator>>(std::istream &, CursorSlice & ); > + undocumented, why is it here who uses it etc. the same in DocIterator.h > + > +void FuncRequest::serializeFrom(std::vector<unsigned char> const & v) can be the variables named in more clear way or have some comments? > diff --git a/src/LFUNHolder.h b/src/LFUNHolder.h > new file mode 100644 > index 0000000..bde2402 > --- /dev/null > +++ b/src/LFUNHolder.h > @@ -0,0 +1,60 @@ > +// -*- C++ -*- > +/** > + * \file LFUNHolder.h > + * > + * This file is part of LyX, the document processor. > + * Licence details can be found in the file COPYING. > + * > + * \author Sushant Raikar > + * > +*/ > + > +#ifndef LFUN_HOLDER_H > +#define LFUN_HOLDER_H > + > + > +#include <vector> > +#include <string> > +#include <errno.h> > +#include <FuncRequest.h> > +#include <Cursor.h> > +#include <DocIterator.h> > + > + > +namespace lyx { > + > +class FuncRequest; > + > +class LFUNHolder { > +public: > + LFUNHolder(); > + LFUNHolder(Buffer * buffer); > + ~LFUNHolder(); > + > + std::vector<unsigned char> serialize(); > + void unserialize(std::vector<unsigned char> const & v); > + > + void attach_LFUN(FuncRequest cmd); > + FuncRequest* detach_LFUN(); > + bool get_LFUN(FuncRequest &); > + > + void attach_version(unsigned int const & ver); > + unsigned int detach_version(); > + bool get_version(int &); > + > + void attach_DocIt(DocIterator &); > + DocIterator* detach_DocIt(); > + bool get_DocIt(DocIterator &); > + > + void clear(); > + > +private: > + int prefix; > + int version; > + FuncRequest * funcrequest_; > + DocIterator * dociterator_; completely undocumented. this is the case in other headers as well. > +/*! > + * \var lyx::FuncCode lyx::LFUN_COLLABORATE_CONNECT > + * \li Action: Connect to remote LyX instance for collaborative editing > + * \li Syntax: connect host port > + * \li Params: <host>: The host name or IP address > + * \li Params: <port>: The IP port where to connect to \li Params: should be used only in first line > diff --git a/src/moc_BufferView.cpp b/src/moc_BufferView.cpp > new file mode 100644 > index 0000000..1a3b40d > --- /dev/null > +++ b/src/moc_BufferView.cpp i don't think we track moc files. > +#include <sys/types.h> > +#include <sys/socket.h> > +#include <netdb.h> > +#include <assert.h> > +#include <string.h> > +#include <errno.h> > +#include <stdio.h> > +#include <fcntl.h> > +#include <arpa/inet.h> > +#include <unistd.h> i wonder how this is portable. have you tried to run this under windows? looks