Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
Lars Gullik Bjønnes wrote:
| > We now get a class (and header
| > file) that will have to include a multitude of other header files. and
| > in cases headerfiles that callers does not need at all.
| | Right, initially I didn't want to put these additional headers and use
| forward declaration but scoped_ptr requires them (MSVC gives errors).
| We have three solutions here:

Hmm... does MSVC have problems there as well...

Are you sure that gcc doesn't? You can compile this:

class A;

class B {
private:
    boost::scoped_ptr<A> a_;
}

With MSVC I need #include "A.h" instead of class A.

Wait, I've tried again and it seems to work now... weird. I must have done some namespace mistakes last time I tried! ;-/

I'll do the correction.

Hum... I've done the change (see attached) but it's more complicated than that. For example, InsetMathNest.C should not care about BufferList but I need to include "bufferlist.h" to avoid this compilation error below. Any idea someone?

------ Build started: Project: mathed, Configuration: Debug Win32 ------
Compiling...
InsetMathNest.C
..\..\..\..\src\mathed\InsetMathNest.C(931) : warning C4244: 'argument' : conversion from 'const unsigned long' to 'char', possible loss of data D:\devel\lyx\trunk\boost\boost/checked_delete.hpp(32) : error C2027: use of undefined type 'BufferList' D:\devel\lyx\trunk\src\frontends/Application.h(18) : see declaration of 'BufferList' D:\devel\lyx\trunk\boost\boost/scoped_ptr.hpp(77) : see reference to function template instantiation 'void boost::checked_delete<T>(T *)' being compiled
        with
        [
            T=BufferList
        ]
D:\devel\lyx\trunk\boost\boost/scoped_ptr.hpp(73) : while compiling class template member function 'boost::scoped_ptr<T>::~scoped_ptr(void)'
        with
        [
            T=BufferList
        ]
D:\devel\lyx\trunk\src\frontends/Application.h(92) : see reference to class template instantiation 'boost::scoped_ptr<T>' being compiled
        with
        [
            T=BufferList
        ]
D:\devel\lyx\trunk\boost\boost/checked_delete.hpp(32) : error C2118: negative subscript D:\devel\lyx\trunk\boost\boost/checked_delete.hpp(34) : warning C4150: deletion of pointer to incomplete type 'BufferList'; no destructor called D:\devel\lyx\trunk\src\frontends/Application.h(18) : see declaration of 'BufferList'
Index: Application.C
===================================================================
--- Application.C       (revision 15161)
+++ Application.C       (working copy)
@@ -12,9 +12,13 @@
 
 #include "Application.h"
 
+#include "bufferlist.h"
 #include "funcrequest.h"
 #include "LyXAction.h"
+#include "lyxfunc.h"
 #include "lyxrc.h"
+#include "lyxserver.h"
+#include "lyxsocket.h"
 #include "LyXView.h"
 
 #include "support/lstrings.h"
@@ -36,7 +40,7 @@
 
 LyXFunc & Application::lyxFunc()
 {
-       return *lyxfunc_.get(); 
+       return *lyxfunc_.get();
 }
 
 
@@ -72,13 +76,13 @@
 
 BufferList & Application::bufferList()
 {
-       return buffer_list_;
+       return *buffer_list_.get();
 }
 
 
 BufferList const & Application::bufferList() const
 {
-       return buffer_list_;
+       return *buffer_list_.get();
 }
 
 
Index: Application.h
===================================================================
--- Application.h       (revision 15161)
+++ Application.h       (working copy)
@@ -11,17 +11,15 @@
 #ifndef LYX_APPLICATION_H
 #define LYX_APPLICATION_H
 
-#include "bufferlist.h"
-#include "lyxfunc.h"
-#include "lyxserver.h"
-#include "lyxsocket.h"
-
 #include <boost/scoped_ptr.hpp>
 
 #include <string>
 
+class BufferList;
 class BufferView;
-class LyXView;
+class LyXFunc;
+class LyXServer;
+class LyXServerSocket;
 
 namespace lyx {
 namespace frontend {
@@ -91,7 +89,7 @@
        ///
        boost::scoped_ptr<LyXServerSocket> lyx_socket_;
        ///
-       BufferList buffer_list_;
+       boost::scoped_ptr<BufferList> buffer_list_;
 
 }; // Application
 

Reply via email to