libzypp  17.22.0
signals.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \----------------------------------------------------------------------/
9 *
10 * This file contains private API, this might break at any time between releases.
11 * You have been warned!
12 *
13 */
14 #ifndef ZYPP_NG_BASE_SIGNALS_H_INCLUDED
15 #define ZYPP_NG_BASE_SIGNALS_H_INCLUDED
16 
17 #include <sigc++/trackable.h>
18 #include <sigc++/signal.h>
19 #include <sigc++/connection.h>
20 
21 namespace zyppng {
22 
23 using sigc::signal;
24 using sigc::connection;
25 using sigc::trackable;
26 
27 template <class R, class... T>
29 
35 template <class R, class... T>
36 class SignalProxy<R(T...)>
37 {
38 public:
39  using SlotType = sigc::slot<R(T...)>;
40  using SignalType = sigc::signal<R(T...)>;
41 
42  SignalProxy ( SignalType &sig ) : _sig ( sig ) {}
43 
51  connection connect( const SlotType& slot )
52  {
53  return _sig.connect( slot );
54  }
55 
59  connection connect( SlotType&& slot )
60  {
61  return _sig.connect( std::move( slot ) );
62  }
63 
64 private:
66 };
67 
68 
69 }
70 
71 #endif // ZYPP_NG_CORE_SIGNALS_H_INCLUDED
sigc::signal< R(T...)> SignalType
Definition: signals.h:40
sigc::slot< R(T...)> SlotType
Definition: signals.h:39
connection connect(const SlotType &slot)
Connects a signal handler to a signal.
Definition: signals.h:51
SignalProxy(SignalType &sig)
Definition: signals.h:42
connection connect(SlotType &&slot)
Connects a signal handler to a signal.
Definition: signals.h:59