yasmine
adapter_cpp03.hpp
Go to the documentation of this file.
1 // //
3 // This file is part of the Seadex yasmine ecosystem (http://yasmine.seadex.de). //
4 // Copyright (C) 2016-2017 Seadex GmbH //
5 // //
6 // Licensing information is available in the folder "license" which is part of this distribution. //
7 // The same information is available on the www @ http://yasmine.seadex.de/Licenses.html. //
8 // //
10 
11 #ifndef ADAPTER_CPP03_F4E4A216_157F_4271_9E7D_476521F6101E
12 #define ADAPTER_CPP03_F4E4A216_157F_4271_9E7D_476521F6101E
13 
14 
15 #ifndef SX_CPP03_BOOST
16 
17 
18 // Nothing to do... adapter_cpp11 is used.
19 
20 
21 #else
22 
23 
24 #include "essentials/compatibility/compatibility.hpp"
25 
26 
27 namespace sxy
28 {
29 
30 
31 class event_collector;
32 
33 
34 template<typename T>
35 sxe::function<void()> adapt( T* _object, void ( T::*_method )( ) )
36 {
37  return( sxe::bind( _method, _object ) );
38 }
39 
40 
41 template<typename T>
42 sxe::function<void()> adapt( T* _object, void ( T::*_method )( ) const )
43 {
44  return( sxe::bind( _method, _object ) );
45 }
46 
47 
48 template<typename T, typename _event_type>
49 sxe::function<void( const _event_type& )> adapt( T* _object, void ( T::*_method )( const _event_type& ) )
50 {
51  return( sxe::bind( _method, _object, sxe::_1 ) );
52 }
53 
54 
55 template<typename T, typename _event_type>
56 sxe::function<void( const _event_type& )> adapt( T* _object, void ( T::*_method )( const _event_type& ) const )
57 {
58  return( sxe::bind( _method, _object, sxe::_1 ) );
59 }
60 
61 
62 template<typename T>
63 sxe::function<void( sxy::event_collector& )> adapt( T* _object, void ( T::*_method )( sxy::event_collector& ) )
64 {
65  return( sxe::bind( _method, _object, sxe::_1 ) );
66 }
67 
68 
69 template<typename T>
70 sxe::function<void( sxy::event_collector& )> adapt( T* _object, void ( T::*_method )( sxy::event_collector& ) const )
71 {
72  return( sxe::bind( _method, _object, sxe::_1 ) );
73 }
74 
75 
76 template<typename T, typename _event_type>
77 sxe::function<void( const _event_type&, sxy::event_collector& )> adapt( T* _object,
78  void ( T::*_method )( const _event_type&, sxy::event_collector& ) )
79 {
80  return( sxe::bind( _method, _object, sxe::_1, sxe::_2 ) );
81 }
82 
83 
84 template<typename T, typename _event_type>
85 sxe::function<void( const _event_type&, sxy::event_collector& )> adapt( T* _object,
86  void ( T::*_method )( const _event_type&, sxy::event_collector& ) const )
87 {
88  return( sxe::bind( _method, _object, sxe::_1, sxe::_2 ) );
89 }
90 
91 
92 sxe::function<void()> adapt_function( void( *_function )( ) );
93 
94 
95 sxe::function<void( sxy::event_collector& )> adapt_function( void( *_function )( sxy::event_collector& ) );
96 
97 
98 template< typename _event_type >
99 sxe::function<void( const _event_type& )> adapt_function( void( *_function )( const _event_type& ) )
100 {
101  return( sxe::bind( _function, sxe::_1 ) );
102 }
103 
104 
105 template< typename _event_type >
106 sxe::function<void( const _event_type&, sxy::event_collector& )> adapt_function(
107  void( *_function )( const _event_type&, sxy::event_collector& ) )
108 {
109  return( sxe::bind( _function, sxe::_1, sxe::_2 ) );
110 }
111 
112 
113 
114 template<typename T>
115 sxe::function<bool()> adapt( T* _object, bool ( T::*_method )( ) )
116 {
117  return( sxe::bind( _method, _object ) );
118 }
119 
120 
121 template<typename T>
122 sxe::function<bool()> adapt( T* _object, bool ( T::*_method )( ) const )
123 {
124  return( sxe::bind( _method, _object ) );
125 }
126 
127 
128 template<typename T, typename _event_type>
129 sxe::function<bool( const _event_type& )> adapt( T* _object, bool ( T::*_method )( const _event_type& ) )
130 {
131  return( sxe::bind( _method, _object, sxe::_1 ) );
132 }
133 
134 
135 template<typename T, typename _event_type>
136 sxe::function<bool( const _event_type& )> adapt( T* _object, bool ( T::*_method )( const _event_type& ) const )
137 {
138  return( sxe::bind( _method, _object, sxe::_1 ) );
139 }
140 
141 
142 template<typename T>
143 sxe::function<bool( sxy::event_collector& )> adapt( T* _object,
144  bool ( T::*_method )( sxy::event_collector& ) )
145 {
146  return( sxe::bind( _method, _object, sxe::_1 ) );
147 }
148 
149 
150 template<typename T>
151 sxe::function<bool( sxy::event_collector& )> adapt( T* _object,
152  bool ( T::*_method )( sxy::event_collector& ) const )
153 {
154  return( sxe::bind( _method, _object, sxe::_1 ) );
155 }
156 
157 
158 template<typename T, typename _event_type>
159 sxe::function<bool( const _event_type&, sxy::event_collector& )> adapt( T* _object,
160  bool ( T::*_method )( const _event_type&, sxy::event_collector& ) )
161 {
162  return( sxe::bind( _method, _object, sxe::_1, sxe::_2 ) );
163 }
164 
165 
166 template<typename T, typename _event_type>
167 sxe::function<bool( const _event_type&, sxy::event_collector& )> adapt( T* _object,
168  bool ( T::*_method )( const _event_type&, sxy::event_collector& ) const )
169 {
170  return( sxe::bind( _method, _object, sxe::_1, sxe::_2 ) );
171 }
172 
173 
174 sxe::function<bool()> adapt_function( bool( *_function )( ) );
175 
176 
177 sxe::function<bool( sxy::event_collector& )> adapt_function( bool( *_function )( sxy::event_collector& ) );
178 
179 
180 template< typename _event_type >
181 sxe::function<bool( const _event_type& )> adapt_function( bool( *_function )( const _event_type& ) )
182 {
183  return( sxe::bind( _function, sxe::_1 ) );
184 }
185 
186 
187 template< typename _event_type >
188 sxe::function<bool( const _event_type&, sxy::event_collector& )> adapt_function(
189  bool( *_function )( const _event_type&, sxy::event_collector& ) )
190 {
191  return( sxe::bind( _function, sxe::_1, sxe::_2 ) );
192 }
193 
194 
195 }
196 
197 
198 #endif
199 
200 
201 #endif
Definition: event_collector.hpp:25
Definition: adapter_cpp11.hpp:21
sxe::function< void()> adapt(T *_object, void(T::*_method)())
Definition: adapter_cpp11.hpp:29
sxe::function< void(sxy::event_collector &)> adapt_function(void(*_function)(sxy::event_collector &))
Definition: adapter_cpp11.hpp:125