Using C++ Boost libraries for KDevelop

Vladimir Prus ghost at cs.msu.su
Thu Nov 17 11:43:03 UTC 2005


> >     class SomeOtherClass {
> >     public:
> >         void do_operation()
> >         {
> >                 controller->queueCmd(
> >                    "whatever",
> >    				boost::bind(&SomeOtherClass::step_2, this));
> >         }
> >         void step_2()
> >         {
> > 			// Continue with the operation.
> >         }
> >     };
> >
> > Here:
> > - boost::function<void ()> is a generic functional object taking
> >   no arguments and returning nothing
> > - boost::bind in the above example takes method pointer, and this,
> >   and binds them together. The resulting class instance can be
> >   called with zero arguments.
>
> How about something like this:
>
> controller->queueCmd("whatever", this, SLOT(step_2());
> with
> void Controller::queueCmd(const char* cmd, QObject* recv, const char* slot)
> {
>    //this can also be done conditionally:
>    connect(this, SIGNAL(cmdDone()), recv, slot);
>    //I guess there's also a way to invoke a slot more directly
>    // with some more low-level Qt stuff, QMetaObject or something
>    //so you wouldn't need to emit the signal

This might work, but won't help in slightly more contrived case:

        void do_operation()
        {
                 controller->queueCmd(
                    "whatever",
    				boost::bind(&SomeOtherClass::step_2, this, some_value));
         }
         void step_2(some_type some_parameter)
         {
 			// Continue with the operation.
         }

> From my experience, when I tried to use boost signals, I had to include
> large parts of boost. 

Well,
1. Boost.Signals != Boost.Function
2. I can make a noise on Boost ml about Boost.Function dependencies
3. I can implement trimmed down boost::function in no time, Boost.Bind is
   more important here.

> So, for now, I wouldn't be overly happy if kdevelop 
> would require boost.

That's why I've asked some specific questions:

> - is it OK to add extra third party dependencies, in general
> - any conditions the dependency must fulfill?
> - it is best to rely on pre-installed dependency, or package it
>   with KDevelop?

Basically, one self-contained 1K third-party header can be just added to 
debugger sources without discussion. 1GB third-party library that works only 
with CVS version of gcc is no-no. Where's the boundary between those extreme 
cases?

- Volodya









More information about the KDevelop-devel mailing list