X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Fsignals%2Fslot.hpp;h=bbf18480106f0551eb2a5601574fe3dafe7f7ec0;hb=ebf6773c50989372bf1a4d6a3ba66673634e65ff;hp=640fee1355750d32effb64ca46c5cc5dfd726306;hpb=e1644a68eb123c267a7ef2e651c66b788c38f03a;p=lyx.git diff --git a/boost/boost/signals/slot.hpp b/boost/boost/signals/slot.hpp index 640fee1355..bbf1848010 100644 --- a/boost/boost/signals/slot.hpp +++ b/boost/boost/signals/slot.hpp @@ -1,15 +1,9 @@ // Boost.Signals library -// -// Copyright (C) 2001-2002 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. + +// Copyright Douglas Gregor 2001-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org @@ -20,8 +14,13 @@ #include #include #include +#include #include +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif + namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { @@ -30,20 +29,26 @@ namespace boost { // friends to make this private (as it otherwise should be). We can't // name all of them because we don't know how many there are. public: + struct data_t { + std::vector bound_objects; + connection watch_bound_objects; + }; + shared_ptr get_data() const { return data; } + // Get the set of bound objects std::vector& get_bound_objects() const - { return bound_objects; } + { return data->bound_objects; } // Determine if this slot is still "active", i.e., all of the bound // objects still exist - bool is_active() const { return watch_bound_objects.connected(); } + bool is_active() const + { return data->watch_bound_objects.connected(); } protected: // Create a connection for this slot void create_connection(); - mutable std::vector bound_objects; - connection watch_bound_objects; + shared_ptr data; private: static void bound_object_destructed(void*, void*) {} @@ -88,7 +93,9 @@ namespace boost { typename BOOST_SIGNALS_NAMESPACE::detail::get_slot_tag::type tag_type(const F&) { - typename BOOST_SIGNALS_NAMESPACE::detail::get_slot_tag::type tag; + typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_slot_tag::type + the_tag_type; + the_tag_type tag = the_tag_type(); return tag; } @@ -96,17 +103,24 @@ namespace boost { template class slot : public BOOST_SIGNALS_NAMESPACE::detail::slot_base { + typedef BOOST_SIGNALS_NAMESPACE::detail::slot_base inherited; + typedef typename inherited::data_t data_t; + public: template slot(const F& f) : slot_function(BOOST_SIGNALS_NAMESPACE::get_invocable_slot(f, BOOST_SIGNALS_NAMESPACE::tag_type(f))) { + this->data.reset(new data_t); + // Visit each of the bound objects and store them for later use // An exception thrown here will allow the basic_connection to be // destroyed when this goes out of scope, and no other connections // have been made. - BOOST_SIGNALS_NAMESPACE::detail::bound_objects_visitor do_bind(bound_objects); - visit_each(do_bind, BOOST_SIGNALS_NAMESPACE::get_inspectable_slot(f, BOOST_SIGNALS_NAMESPACE::tag_type(f))); - + BOOST_SIGNALS_NAMESPACE::detail::bound_objects_visitor + do_bind(this->data->bound_objects); + visit_each(do_bind, + BOOST_SIGNALS_NAMESPACE::get_inspectable_slot + (f, BOOST_SIGNALS_NAMESPACE::tag_type(f))); create_connection(); } @@ -114,6 +128,7 @@ namespace boost { template slot(F* f) : slot_function(f) { + this->data.reset(new data_t); create_connection(); } #endif // __BORLANDC__ @@ -125,6 +140,8 @@ namespace boost { // Get the slot function to call the actual slot const SlotFunction& get_slot_function() const { return slot_function; } + void release() const { data->watch_bound_objects.set_controlling(false); } + private: slot(); // no default constructor slot& operator=(const slot&); // no assignment operator @@ -133,4 +150,8 @@ namespace boost { }; } // end namespace boost +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif + #endif // BOOST_SIGNALS_SLOT_HEADER