comparison qt/d2/qt/Signal.d @ 246:7e589f525254

Removed debug toString
author maxter
date Sun, 26 Jul 2009 16:15:42 +0000
parents a1b48a630f73
children 073b9153ed8a
comparison
equal deleted inserted replaced
245:2d061b52e077 246:7e589f525254
18 import 18 import
19 std.traits, 19 std.traits,
20 core.thread, 20 core.thread,
21 core.exception; 21 core.exception;
22 22
23
24
25 debug import std.stdio;
26
27 private: // private by default 23 private: // private by default
28 24
29 alias void delegate(Object) DEvent; 25 alias void delegate(Object) DEvent;
30 26
31 extern(C) void rt_attachDisposeEvent(Object o, DEvent e); 27 extern(C) void rt_attachDisposeEvent(Object o, DEvent e);
107 S get(S)() 103 S get(S)()
108 { 104 {
109 static assert (is(typeof(*S.init) == function)); 105 static assert (is(typeof(*S.init) == function));
110 return cast(S)funcptr; 106 return cast(S)funcptr;
111 } 107 }
112
113 debug string toString()
114 {
115 return Stdout.layout.convert("funcptr: {}", funcptr);
116 }
117 } 108 }
118 109
119 struct Dg 110 struct Dg
120 { 111 {
121 void* context; 112 void* context;
145 static assert (is(S == delegate)); 136 static assert (is(S == delegate));
146 S r; 137 S r;
147 r.ptr = context; 138 r.ptr = context;
148 r.funcptr = cast(typeof(r.funcptr))funcptr; 139 r.funcptr = cast(typeof(r.funcptr))funcptr;
149 return r; 140 return r;
150 }
151
152 debug string toString()
153 {
154 return Stdout.layout.convert("context: {}, funcptr: {}", context, funcptr);
155 } 141 }
156 } 142 }
157 143
158 struct Slot(R) 144 struct Slot(R)
159 { 145 {
189 return lock ? _d_toObject(receiver.context) : null; 175 return lock ? _d_toObject(receiver.context) : null;
190 } 176 }
191 } 177 }
192 else 178 else
193 static const isDelegate = false; 179 static const isDelegate = false;
194
195 debug string toString()
196 {
197 return Stdout.layout.convert("receiver: {}, invoker {}: ", receiver, invoker);
198 }
199 } 180 }
200 181
201 enum SlotListId 182 enum SlotListId
202 { 183 {
203 Func, // function pointers 184 Func, // function pointers
346 } 327 }
347 } 328 }
348 static if (!strong) 329 static if (!strong)
349 cfree(data.ptr); 330 cfree(data.ptr);
350 } 331 }
351
352 debug string toString()
353 {
354 string r;
355 foreach(e; data)
356 r ~= e.toString ~ "\n";
357 return r;
358 }
359 } 332 }
360 333
361 public alias void delegate(int signalId) SignalEvent; 334 public alias void delegate(int signalId) SignalEvent;
362 335
363 struct SignalConnections 336 struct SignalConnections
444 } 417 }
445 418
446 template ReceiverType(int slotListId) 419 template ReceiverType(int slotListId)
447 { 420 {
448 alias SlotType!(slotListId).Receiver ReceiverType; 421 alias SlotType!(slotListId).Receiver ReceiverType;
449 }
450
451 debug string toString()
452 {
453 string r;
454 foreach(i, e; slotLists.tupleof)
455 {
456 r ~= Stdout.layout.convert("Slot list {}:", i);
457 r ~= slotLists.at!(i).toString;
458 }
459 return r;
460 } 422 }
461 423
462 static const slotListCount = slotLists.tupleof.length; 424 static const slotListCount = slotLists.tupleof.length;
463 } 425 }
464 426
714 ~this() 676 ~this()
715 { 677 {
716 foreach(ref c; connections) 678 foreach(ref c; connections)
717 c.free; 679 c.free;
718 } 680 }
719
720 debug string toString()
721 {
722 string r;
723 foreach (i, c; connections)
724 r ~= Stdout.layout.convert("Signal {}:\n{}", i, c.toString);
725 return r;
726 }
727 } 681 }
728 682
729 //TODO: this could be avoided if named mixins didn't suck. 683 //TODO: this could be avoided if named mixins didn't suck.
730 public struct SignalOps(int sigId, A...) 684 public struct SignalOps(int sigId, A...)
731 { 685 {