X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Fsignal.hpp;h=d1538e110d194865d390d9e2ff093d085544e64a;hb=b01a9dc187d9cd396a57463ad27511379dcdc9cd;hp=a7400096cab6fdbc23a2ea50d7449d0a5c935429;hpb=59b6a4701a8d2b5155af08cf758b4ca120201282;p=lyx.git diff --git a/boost/boost/signal.hpp b/boost/boost/signal.hpp index a7400096ca..d1538e110d 100644 --- a/boost/boost/signal.hpp +++ b/boost/boost/signal.hpp @@ -1,24 +1,21 @@ // Boost.Signals library -// -// Copyright (C) 2001 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. - -// For more information, see http://www.boost.org + +// Copyright Douglas Gregor 2001-2006. 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/libs/signals #ifndef BOOST_SIGNAL_HPP #define BOOST_SIGNAL_HPP -#define BOOST_SIGNALS_MAX_ARGS 10 +#ifndef BOOST_SIGNALS_MAX_ARGS +# define BOOST_SIGNALS_MAX_ARGS 10 +#endif #include +#include #include #include #include @@ -30,359 +27,332 @@ #include #include #include +#include + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif namespace boost { - namespace signals { +#ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX + namespace BOOST_SIGNALS_NAMESPACE { namespace detail { - // The unusable class is a placeholder for unused function arguments. - struct unused {}; + template + class real_get_signal_impl; - // value=1 if the given type is not "unused" - template - struct count_if_used - { - BOOST_STATIC_CONSTANT(int, value = 1); - }; - - // value=0 for unused types - template<> - struct count_if_used - { - BOOST_STATIC_CONSTANT(int, value = 0); - }; - - // Count the number of arguments (from the given set) which are not - // "unused" (therefore, count those arguments that are used). - template - struct count_used_args + template + class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - BOOST_STATIC_CONSTANT(int, value = - (count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value)); - }; - - // Choose the appropriate underlying implementation - template struct real_get_signal_impl {}; + typedef function_traits traits; - template<> - struct real_get_signal_impl<0> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal0 type; - }; + public: + typedef signal0 type; }; - template<> - struct real_get_signal_impl<1> + template + class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal1 type; - }; + typedef function_traits traits; + + public: + typedef signal1 type; }; - template<> - struct real_get_signal_impl<2> + template + class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal2 type; - }; + typedef function_traits traits; + + public: + typedef signal2 type; }; - template<> - struct real_get_signal_impl<3> + template + class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal3 type; - }; + typedef function_traits traits; + + public: + typedef signal3 type; }; - template<> - struct real_get_signal_impl<4> + template + class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal4 type; - }; + typedef function_traits traits; + + public: + typedef signal4 type; }; - template<> - struct real_get_signal_impl<5> + template + class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal5 - type; - }; + typedef function_traits traits; + + public: + typedef signal5 type; }; - template<> - struct real_get_signal_impl<6> + template + class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal6 type; - }; + typedef function_traits traits; + + public: + typedef signal6 type; }; - template<> - struct real_get_signal_impl<7> + template + class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal7 type; - }; + typedef function_traits traits; + + public: + typedef signal7 type; }; - template<> - struct real_get_signal_impl<8> + template + class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal8 type; - }; + typedef function_traits traits; + + public: + typedef signal8 type; }; - template<> - struct real_get_signal_impl<9> + template + class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal9 type; - }; + typedef function_traits traits; + + public: + typedef signal9 type; }; - template<> - struct real_get_signal_impl<10> + template + class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct params - { - typedef signal10 type; - }; + typedef function_traits traits; + + public: + typedef signal10 type; }; - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner = last_value - > - struct get_signal_impl + template + struct get_signal_impl : + public real_get_signal_impl<(function_traits::arity), + Signature, + Combiner, + Group, + GroupCompare, + SlotFunction> { - typedef typename real_get_signal_impl< - (count_used_args::value) - >::template params::type - type; }; + } // end namespace detail - } // end namespace signals + } // end namespace BOOST_SIGNALS_NAMESPACE // Very lightweight wrapper around the signalN classes that allows signals to // be created where the number of arguments does not need to be part of the // class name. template< - typename R, - typename T1 = signals::detail::unused, - typename T2 = signals::detail::unused, - typename T3 = signals::detail::unused, - typename T4 = signals::detail::unused, - typename T5 = signals::detail::unused, - typename T6 = signals::detail::unused, - typename T7 = signals::detail::unused, - typename T8 = signals::detail::unused, - typename T9 = signals::detail::unused, - typename T10 = signals::detail::unused + typename Signature, // function type R (T1, T2, ..., TN) + typename Combiner = last_value::result_type>, + typename Group = int, + typename GroupCompare = std::less, + typename SlotFunction = function > class signal : - public signals::detail::get_signal_impl::type + public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl::type { + typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl< + Signature, + Combiner, + Group, + GroupCompare, + SlotFunction>::type base_type; + public: - template - struct combiner { - typedef typename signals::detail::get_signal_impl::type - type; - }; + explicit signal(const Combiner& combiner = Combiner(), + const GroupCompare& group_compare = GroupCompare()) : + base_type(combiner, group_compare) + { + } }; +#endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX + } // end namespace boost +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif + #endif // BOOST_SIGNAL_HPP