r3899 - in trunk/birnet: . tests
- From: timj svn gnome org
- To: svn-commits-list gnome org
- Subject: r3899 - in trunk/birnet: . tests
- Date: Sun, 24 Sep 2006 20:12:25 -0400 (EDT)
Author: timj
Date: 2006-09-24 20:11:59 -0400 (Sun, 24 Sep 2006)
New Revision: 3899
Modified:
trunk/birnet/ChangeLog
trunk/birnet/birnetsignalslot.hh
trunk/birnet/tests/signal.cc
Log:
Mon Sep 25 02:10:43 2006 Tim Janik <timj gtk org>
* birnetsignalslot.hh: fixed reference handling for Data slots, so
reference types are supported as Data argument (they need to implement
operator==() though).
* tests/signal.cc: added data reference slot creation.
Modified: trunk/birnet/ChangeLog
===================================================================
--- trunk/birnet/ChangeLog 2006-09-22 13:42:20 UTC (rev 3898)
+++ trunk/birnet/ChangeLog 2006-09-25 00:11:59 UTC (rev 3899)
@@ -1,3 +1,11 @@
+Mon Sep 25 02:10:43 2006 Tim Janik <timj gtk org>
+
+ * birnetsignalslot.hh: fixed reference handling for Data slots, so
+ reference types are supported as Data argument (they need to implement
+ operator==() though).
+
+ * tests/signal.cc: added data reference slot creation.
+
Thu Sep 21 00:16:05 2006 Tim Janik <timj gtk org>
* birnetutils.h, birnetutilsxx.cc: added birnet_cxx_demangle() and
Modified: trunk/birnet/birnetsignalslot.hh
===================================================================
--- trunk/birnet/birnetsignalslot.hh 2006-09-22 13:42:20 UTC (rev 3898)
+++ trunk/birnet/birnetsignalslot.hh 2006-09-25 00:11:59 UTC (rev 3899)
@@ -78,7 +78,7 @@
const DataFunctionTrampoline3 *other = dynamic_cast<const DataFunctionTrampoline3*> (&bother);
return other and other->callback == callback and other->data == data; }
public:
- DataFunctionTrampoline3 (Callback c, const Data &d) :
+ DataFunctionTrampoline3 (Callback c, const Data d) :
callback (c), data (d)
{}
};
@@ -95,7 +95,7 @@
virtual ~DataMethodTrampoline3() { deletable_remove_hook (instance); }
virtual void deletable_dispose (Deletable &deletable) { instance = NULL; this->callable = false; }
public:
- DataMethodTrampoline3 (Class &obj, Method m, const Data &d) :
+ DataMethodTrampoline3 (Class &obj, Method m, const Data d) :
instance (&obj), method (m), data (d) { deletable_add_hook (instance); }
};
@@ -113,20 +113,30 @@
return Slot3<R0, A1, A2, A3> (new FunctionTrampoline3<R0, A1, A2, A3> (callback));
}
template<typename R0, typename A1, typename A2, typename A3, typename Data> Slot3<R0, A1, A2, A3>
-slot (R0 (*callback) (A1, A2, A3, Data), const Data &data)
+slot (R0 (*callback) (A1, A2, A3, Data), const Data data)
{
return Slot3<R0, A1, A2, A3> (new DataFunctionTrampoline3<R0, A1, A2, A3, Data> (callback, data));
}
+template<typename R0, typename A1, typename A2, typename A3, typename Data> Slot3<R0, A1, A2, A3>
+slot (R0 (*callback) (A1, A2, A3, Data&), Data &data)
+{
+ return Slot3<R0, A1, A2, A3> (new DataFunctionTrampoline3<R0, A1, A2, A3, Data&> (callback, data));
+}
template<class Class, typename R0, typename A1, typename A2, typename A3> Slot3<R0, A1, A2, A3>
slot (Class &obj, R0 (Class::*method) (A1, A2, A3))
{
return Slot3<R0, A1, A2, A3> (new MethodTrampoline3<Class, R0, A1, A2, A3> (obj, method));
}
template<class Class, typename R0, typename A1, typename A2, typename A3, typename Data> Slot3<R0, A1, A2, A3>
-slot (Class &obj, R0 (Class::*method) (A1, A2, A3, Data), const Data &data)
+slot (Class &obj, R0 (Class::*method) (A1, A2, A3, Data), const Data data)
{
return Slot3<R0, A1, A2, A3> (new DataMethodTrampoline3<Class, R0, A1, A2, A3, Data> (obj, method, data));
}
+template<class Class, typename R0, typename A1, typename A2, typename A3, typename Data> Slot3<R0, A1, A2, A3>
+slot (Class &obj, R0 (Class::*method) (A1, A2, A3, Data&), Data &data)
+{
+ return Slot3<R0, A1, A2, A3> (new DataMethodTrampoline3<Class, R0, A1, A2, A3, Data&> (obj, method, data));
+}
template<typename Obj, typename R0, typename A1, typename A2, typename A3> Slot3<R0, A1, A2, A3>
slot (Signal<Obj, R0 (A1, A2, A3)> &sigref)
{
Modified: trunk/birnet/tests/signal.cc
===================================================================
--- trunk/birnet/tests/signal.cc 2006-09-22 13:42:20 UTC (rev 3898)
+++ trunk/birnet/tests/signal.cc 2006-09-25 00:11:59 UTC (rev 3899)
@@ -88,6 +88,13 @@
__func__, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, x.message());
return __func__;
}
+ static String test_string_14_refdata (int a1, double a2, int a3, double a4, int a5, double a6, int a7, double a8, int a9,
+ double a10, int a11, double a12, int a13, double a14, ExtraType &xref)
+ {
+ TPRINT (" callback: %s (%d, %.1f, %d, %.1f, %d, %.1f, %d, %.1f, %d, %.1f, %d, %.1f, %d, %.1f, %s);\n",
+ __func__, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, xref.message());
+ return __func__;
+ }
void testme ()
{
TSTART ("Signals, multi-arg");
@@ -108,9 +115,10 @@
sig_void_14.emit (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
sig_void_15.emit (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
sig_void_16.emit (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
- ExtraType xt;
+ ExtraType xt, &xref = xt;
sig_string_14 += slot (test_string_14_emitter_data, xt);
sig_string_14 += slot (test_string_14_data, xt);
+ sig_string_14 += slot (test_string_14_refdata, xref);
String results;
results += sig_string_0.emit ();
results += sig_string_1.emit (1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]