Type info
Title Boost mem_fn/bind support for C++-UNO interface methods
Posted by [EMAIL PROTECTED]
Affected ...,
Effective from cws presfixes08


Summary

Define

+ BOOST_MEM_FN_ENABLE_CDECL
prior to including boost/mem_fn.hpp or boost/bind.hpp on Windows MSVC.

com/sun/star/uno/Reference.h, namespace com::sun::star::uno:
+ template <typename T>
+ inline T * get_pointer( Reference<T> const& r );

rtl/ref.hxx, namespace rtl:
+ template <typename T>
+ inline T * get_pointer( Reference<T> const& r );


Description
Thanks to Peter Dimov for adding support for __cdecl member functions
in Boost 1.33 (and later). This enables boost::mem_fn()/boost::bind()
to bind C++-UNO interface member functions (SAL_CALL is defined to
__cdecl on Windows MSVC). I have patched this support into our current
boost version.
Define BOOST_MEM_FN_ENABLE_CDECL prior to including boost/mem_fn.hpp
or boost/bind.hpp on Windows MSVC:

#if defined(SAL_W32) && !defined(BOOST_MEM_FN_ENABLE_CDECL)
#define BOOST_MEM_FN_ENABLE_CDECL
#endif
...
#include "boost/bind.hpp"

In addition, I have defined get_pointer() for
com::sun::star::uno::Reference and rtl::Reference, so mem_fn/bind
recognize those types.
This way, e.g. firing an event to all paint listeners of a container
comes down to

myContainer.forEach<awt::XPaintListener>(
boost::bind( &awt::XPaintListener::windowPaint,
_1, awt::PaintEvent(...) );


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to