annotate qt/d2/qt/Signal.d @ 319:894d40eb89b6 signals

new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
author eldar_ins@eldar-laptop
date Fri, 25 Dec 2009 21:48:32 +0500
parents ce07227f00c1
children 5c6455c4889b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
e78566595089 initial import
mandel
parents:
diff changeset
1 /**
e78566595089 initial import
mandel
parents:
diff changeset
2 *
e78566595089 initial import
mandel
parents:
diff changeset
3 * Copyright: Copyright QtD Team, 2008-2009
e78566595089 initial import
mandel
parents:
diff changeset
4 * Authors: Max Samukha, Eldar Insafutdinov
e78566595089 initial import
mandel
parents:
diff changeset
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>
e78566595089 initial import
mandel
parents:
diff changeset
6 *
e78566595089 initial import
mandel
parents:
diff changeset
7 * Copyright QtD Team, 2008-2009
e78566595089 initial import
mandel
parents:
diff changeset
8 * Distributed under the Boost Software License, Version 1.0.
e78566595089 initial import
mandel
parents:
diff changeset
9 * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
e78566595089 initial import
mandel
parents:
diff changeset
10 *
e78566595089 initial import
mandel
parents:
diff changeset
11 */
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 1
diff changeset
12 module qt.Signal;
1
e78566595089 initial import
mandel
parents:
diff changeset
13
e78566595089 initial import
mandel
parents:
diff changeset
14 public import qt.QGlobal;
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
15 import qt.qtd.MetaMarshall;
319
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
16 import qt.qtd.Meta;
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
17
1
e78566595089 initial import
mandel
parents:
diff changeset
18 import core.stdc.stdlib : crealloc = realloc, cfree = free;
e78566595089 initial import
mandel
parents:
diff changeset
19 import core.stdc.string : memmove;
e78566595089 initial import
mandel
parents:
diff changeset
20 import
188
7dd099050621 initial commit for D2 support
eldar
parents: 16
diff changeset
21 core.thread,
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
22 core.exception,
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
23 std.algorithm;
1
e78566595089 initial import
mandel
parents:
diff changeset
24
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
25 public import
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
26 std.typetuple,
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
27 std.traits,
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
28 std.conv,
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
29 std.string,
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
30 std.metastrings;
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
31
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
32
319
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
33 /* returns name, arguments or tuple of the function depending on type parameter
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
34 foo(int, float)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
35 _Name: "foo"
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
36 _Tuple: "(int, float)"
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
37 _Args: "int, float"
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
38 */
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
39 enum {_Name, _Tuple, _Args}
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
40 string getFunc(int type)(string fullName)
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
41 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
42 int pos = 0;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
43 foreach(i, c; fullName)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
44 if (c == '(')
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
45 static if (type == _Tuple)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
46 return fullName[i..$];
319
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
47 else static if (type == _Name)
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
48 return fullName[0..i];
319
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
49 else static if (type == _Args)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
50 for(int j = fullName.length-1; ; j--)
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
51 if(fullName[j] == ')')
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
52 return fullName[i+1 .. j];
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
53 return null;
253
073b9153ed8a Rev. 264 done right.
maxter
parents: 246
diff changeset
54 }
1
e78566595089 initial import
mandel
parents:
diff changeset
55
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
56 /** The beast that takes string representation of function arguments
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
57 * and returns an array of default values it doesn't check if arguments
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
58 * without default values follow the arguments with default values for
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
59 * simplicity. It is done by mixing in an delegate alias.
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
60 */
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
61 string[] defaultValues(string signature)
1
e78566595089 initial import
mandel
parents:
diff changeset
62 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
63 int braces = 0;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
64 bool inDefaultValue = false;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
65 bool inStringLiteral = false;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
66 string[] res;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
67 int startValue = 0;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
68
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
69 if(strip(signature).length == 0)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
70 return res;
1
e78566595089 initial import
mandel
parents:
diff changeset
71
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
72 foreach (i,c; signature)
1
e78566595089 initial import
mandel
parents:
diff changeset
73 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
74 if(!inStringLiteral)
1
e78566595089 initial import
mandel
parents:
diff changeset
75 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
76 if(c == '{' || c =='(')
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
77 braces++;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
78 else if(c == '}' || c ==')')
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
79 braces--;
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
80 }
1
e78566595089 initial import
mandel
parents:
diff changeset
81
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
82 if(c == '\"' || c == '\'')
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
83 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
84 if (inStringLiteral)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
85 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
86 if(signature[i-1] != '\\')
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
87 inStringLiteral = false;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
88 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
89 else
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
90 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
91 inStringLiteral = true;
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
92 }
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
93 }
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
94
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
95 if (!inStringLiteral && braces == 0)
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
96 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
97 if(c == '=') // found default value
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
98 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
99 inDefaultValue = true;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
100 startValue = i+1;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
101 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
102 else if(c == ',') // next function argument
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
103 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
104 if (inDefaultValue)
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
105 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
106 res ~= signature[startValue..i];
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
107 inDefaultValue = false;
276
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
108 }
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
109 }
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
110 }
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
111 }
501128ac7a2c signals cleaned up correctly on receiver destruction
maxter
parents: 268
diff changeset
112
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
113 if (inDefaultValue)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
114 res ~= signature[startValue..$];
1
e78566595089 initial import
mandel
parents:
diff changeset
115
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
116 return res;
1
e78566595089 initial import
mandel
parents:
diff changeset
117 }
e78566595089 initial import
mandel
parents:
diff changeset
118
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
119 int defaultValuesLength(string[] defVals)
1
e78566595089 initial import
mandel
parents:
diff changeset
120 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
121 return defVals.length;
1
e78566595089 initial import
mandel
parents:
diff changeset
122 }
e78566595089 initial import
mandel
parents:
diff changeset
123
e78566595089 initial import
mandel
parents:
diff changeset
124 /**
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
125 New implementation.
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
126 */
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
127
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
128
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
129
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
130 // templates for extracting data from static meta-information of signals, slots or properties
289
c9d1aac290e9 clean up of unneeded functionality
eldar
parents: 288
diff changeset
131 // public alias TypeTuple!("name", index, OwnerClass, ArgTypes) __signal
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
132 template MetaEntryName(source...)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
133 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
134 enum MetaEntryName = source[0]; // name of the metaentry is the first element
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
135 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
136
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
137 template MetaEntryOwner(source...)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
138 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
139 alias TupleWrapper!(source[2]).at[0] MetaEntryOwner; // class that owns the property is the third
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
140 // Compiler #BUG 3092 - evaluates MetaEntryOwner as a Tuple with one element
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
141 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
142
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
143 template MetaEntryArgs(source...)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
144 {
319
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
145 alias ParameterTypeTuple!(source[1]) MetaEntryArgs; // arguments-tuple starts from the fourth position
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
146 }
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
147
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
148 template TupleWrapper(A...) { alias A at; }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
149
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
150 template isDg(Dg)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
151 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
152 enum isDg = is(Dg == delegate);
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
153 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
154
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
155 template isFn(Fn)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
156 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
157 enum isFn = is(typeof(*Fn.init) == function);
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
158 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
159
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
160 template isFnOrDg(Dg)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
161 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
162 enum isFnOrDg = isFn!(Dg) || isDg!(Dg);
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
163 }
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
164
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
165 string joinArgs(A...)()
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
166 {
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
167 string res = "";
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
168 static if(A.length)
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
169 {
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
170 res = A[0].stringof;
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
171 foreach(k; A[1..$])
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
172 res ~= "," ~ k.stringof;
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
173 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
174 return res;
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
175 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
176
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
177 template SlotPred(T1, T2)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
178 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
179 enum SlotPred = is(T1 : T2);
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
180 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
181
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
182 template CheckSlot(alias Needle, alias Source)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
183 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
184 static if(Needle.at.length <= Source.at.length)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
185 enum CheckSlot = CheckArgs!(Needle, Source, SlotPred, 0).value;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
186 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
187 enum CheckSlot = false;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
188 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
189
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
190 template SignalPred(T1, T2)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
191 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
192 enum SignalPred = is(T1 == T2);
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
193 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
194
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
195 template CheckSignal(alias Needle, alias Source)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
196 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
197 static if(Needle.at.length == Source.at.length)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
198 enum CheckSignal = CheckArgs!(Needle, Source, SignalPred, 0).value;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
199 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
200 enum CheckSignal = false;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
201 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
202
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
203 template CheckArgs(alias Needle, alias Source, alias pred, int i)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
204 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
205 static if (i < Needle.at.length)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
206 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
207 static if (pred!(Needle.at[i], Source.at[i]))
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
208 enum value = CheckArgs!(Needle, Source, pred, i + 1).value;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
209 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
210 enum value = false;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
211 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
212 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
213 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
214 enum value = true;
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
215 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
216 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
217
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
218 template SigByNamePred(string name, SlotArgs...)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
219 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
220 template SigByNamePred(source...)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
221 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
222 static if (source[0] == name) // only instantiate CheckSlot if names match
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
223 enum SigByNamePred = CheckSlot!(TupleWrapper!(SlotArgs), TupleWrapper!(source[2 .. $]));
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
224 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
225 enum SigByNamePred = false;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
226 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
227 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
228
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
229 template SigBySignPred(string name, SigArgs...)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
230 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
231 template SigBySignPred(source...)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
232 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
233 static if (source[0] == name) // only instantiate CheckSignal if names match
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
234 enum SigBySignPred = CheckSignal!(TupleWrapper!(SigArgs), TupleWrapper!(source[2 .. $]));
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
235 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
236 enum SigBySignPred = false;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
237 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
238 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
239
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
240 template ByOwner(Owner)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
241 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
242 template ByOwner(source...)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
243 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
244 enum ByOwner = is(MetaEntryOwner!source == Owner);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
245 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
246 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
247
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
248 template staticSymbolName(string prefix, int id)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
249 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
250 const string staticSymbolName = prefix ~ ToString!(id);
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
251 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
252
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
253 template signatureString(string name, A...)
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
254 {
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
255 const string signatureString = name ~ "(" ~ joinArgs!(A) ~ ")";
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
256 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
257
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
258 // recursive search in the static meta-information
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
259 template findSymbolImpl(string prefix, C, int id, alias pred)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
260 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
261 static if ( is(typeof(mixin("C." ~ staticSymbolName!(prefix, id)))) )
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
262 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
263 mixin ("alias C." ~ staticSymbolName!(prefix, id) ~ " current;");
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
264 static if (pred!current)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
265 alias current result;
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
266 else
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
267 alias findSymbolImpl!(prefix, C, id + 1, pred).result result;
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
268 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
269 else
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
270 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
271 alias void result;
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
272 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
273 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
274
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
275 template findSymbol(string prefix, C, alias pred)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
276 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
277 alias findSymbolImpl!(prefix, C, 0, pred).result findSymbol;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
278 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
279
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
280 template findSignal(C, string name, Receiver, SigArgs...)
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
281 {
282
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
282 alias TupleWrapper!(ParameterTypeTuple!Receiver) SlotArgsWr;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
283 static if (SigArgs.length > 0)
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
284 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
285 alias findSymbol!(signalPrefix, C, SigBySignPred!(name, SigArgs)) result;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
286 static if (is(result == void))
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
287 static assert(0, "Signal " ~ name ~ "(" ~ joinArgs!SigArgs() ~ ") was not found.");
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
288 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
289 static if (!CheckSlot!(SlotArgsWr, TupleWrapper!(result[2 .. $])))
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
290 static assert(0, "Signature of slot is incompatible with signal " ~ name ~ ".");
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
291 }
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
292 else
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
293 {
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
294 alias findSymbol!(signalPrefix, C, SigByNamePred!(name, SlotArgsWr.at)) result;
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
295 static if (is(result == void))
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
296 static assert(0, "Signal " ~ name ~ " was not found.");
256ab6cb8e85 Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents: 279
diff changeset
297 }
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
298 }
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
299
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
300 // recursive search in the static meta-information
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
301 template findSymbolsImpl(string prefix, C, int id, alias pred)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
302 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
303 static if ( is(typeof(mixin("C." ~ staticSymbolName!(prefix, id)))) )
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
304 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
305 mixin ("alias C." ~ staticSymbolName!(prefix, id) ~ " current;");
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
306 static if (pred!current) {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
307 alias TupleWrapper!current subres;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
308 // pragma(msg, toStringNow!id ~ " " ~ subres.stringof);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
309 } else
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
310 alias TypeTuple!() subres;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
311 alias TypeTuple!(subres, findSymbolsImpl!(prefix, C, id + 1, pred).result) result;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
312 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
313 else
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
314 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
315 alias TypeTuple!() result;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
316 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
317 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
318
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
319 template findSymbols(string prefix, C, alias pred)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
320 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
321 alias findSymbolsImpl!(prefix, C, 0, pred).result findSymbols;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
322 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
323
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
324 string convertSignalArguments(Args...)()
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
325 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
326 // void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
302
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
327 // at least for string argument need to construct a QString value
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
328 string res = prepareSignalArguments!(Args);
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
329
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
330 res ~= "void*[" ~ __toString(Args.length+1) ~ "] _a = [null";
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
331 foreach(i, _; Args)
318
ce07227f00c1 more signals and QList
eldar_ins@eldar-laptop
parents: 302
diff changeset
332 res ~= ", " ~ "cast(void*) " ~ convertSignalArgument!(Args[i])("_t" ~ __toString(i));
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
333 res ~= "];\n";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
334 return res;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
335 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
336
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
337 public string SignalEmitter(A...)(SignalType signalType, string name, string[] defVals, int localIndex)
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
338 {
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
339 string fullArgs, args;
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
340 int defValsLength = defVals.length;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
341 string argsConversion = "";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
342 string argsPtr = "null";
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
343 static if (A.length)
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
344 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
345 while(A.length != defVals.length)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
346 defVals = "" ~ defVals;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
347
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
348 fullArgs = A[0].stringof ~ " _t0";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
349 if (defVals[0].length)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
350 fullArgs ~= " = " ~ defVals[0];
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
351 args = "_t0";
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
352 foreach(i, _; A[1..$])
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
353 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
354 fullArgs ~= ", " ~ A[i+1].stringof ~ " _t" ~ __toString(i+1);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
355 if (defVals[i+1].length)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
356 fullArgs ~= " = " ~ defVals[i+1];
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
357 args ~= ", _t" ~ __toString(i+1);
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
358 }
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
359 // build up conversion of signal args from D to C++
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
360 argsPtr = "_a.ptr";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
361 argsConversion = convertSignalArguments!(A)();
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
362 }
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
363 string attribute;
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
364 string sigName = name;
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
365 if (signalType == SignalType.BindQtSignal)
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
366 name ~= "_emit";
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
367 else
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
368 attribute = "protected ";
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
369
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
370 string indexArgs = __toString(localIndex);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
371 if(defValsLength > 0)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
372 indexArgs ~= ", " ~ __toString(localIndex+defValsLength);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
373 string str = attribute ~ "final void " ~ name ~ "(" ~ fullArgs ~ ") {\n" ~ argsConversion ~ "\n"
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
374 ~ " QMetaObject.activate(this, typeof(this).staticMetaObject, " ~ indexArgs ~ ", " ~ argsPtr ~ ");\n"
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
375 ~ "}\n"; // ~
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
376 return str;
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
377 }
278
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
378 /** ---------------- */
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
379
5df570e79cfc new syntax for connecting using static information
eldar
parents: 276
diff changeset
380
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
381 const string signalPrefix = "__signal";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
382 const string slotPrefix = "__slot";
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
383
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
384 enum SignalType
1
e78566595089 initial import
mandel
parents:
diff changeset
385 {
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
386 BindQtSignal,
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
387 NewSignal,
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
388 NewSlot
284
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
389 }
1f6923c8cba0 consistent emit syntax.
eldar
parents: 282
diff changeset
390
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
391 template BindQtSignal(string fullName)
1
e78566595089 initial import
mandel
parents:
diff changeset
392 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
393 mixin MetaMethodImpl!(signalPrefix, 0, fullName, SignalType.BindQtSignal);
1
e78566595089 initial import
mandel
parents:
diff changeset
394 }
e78566595089 initial import
mandel
parents:
diff changeset
395
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
396 template Signal(string fullName)
1
e78566595089 initial import
mandel
parents:
diff changeset
397 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
398 mixin MetaMethodImpl!(signalPrefix, 0, fullName, SignalType.NewSignal);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
399 }
1
e78566595089 initial import
mandel
parents:
diff changeset
400
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
401 template Slot(string fullName)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
402 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
403 mixin MetaMethodImpl!(slotPrefix, 0, fullName, SignalType.NewSlot);
1
e78566595089 initial import
mandel
parents:
diff changeset
404 }
e78566595089 initial import
mandel
parents:
diff changeset
405
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
406 template SignalImpl(int index, string fullName, SignalType signalType)
1
e78566595089 initial import
mandel
parents:
diff changeset
407 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
408 static if (is(typeof(mixin(typeof(this).stringof ~ "." ~ signalPrefix ~ ToString!(index)))))
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
409 mixin SignalImpl!(index + 1, fullName, signalType);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
410 else
1
e78566595089 initial import
mandel
parents:
diff changeset
411 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
412 // pragma(msg, "alias void delegate" ~ getFunc!_Tuple(fullName) ~ " Dg;");
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
413 mixin("alias void delegate" ~ getFunc!_Tuple(fullName) ~ " Dg;");
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
414 alias ParameterTypeTuple!(Dg) ArgTypes;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
415 enum args = getFunc!_Args(fullName);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
416 enum defVals = defaultValues(args);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
417 enum defValsLength = defaultValuesLength(defVals);
1
e78566595089 initial import
mandel
parents:
diff changeset
418
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
419 // pragma (msg, SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, index));
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
420 mixin InsertMetaSignal!(fullName, index, defValsLength, ArgTypes);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
421 // pragma (msg, ctfe_meta_signal!(ArgTypes)(fullName, index, defValsLength));
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
422 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
423 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
424 template MetaMethodImpl(string metaPrefix, int index, string fullName, SignalType signalType)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
425 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
426 static if (is(typeof(mixin(typeof(this).stringof ~ "." ~ metaPrefix ~ toStringNow!(index)))))
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
427 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
428 mixin MetaMethodImpl!(metaPrefix, index + 1, fullName, signalType);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
429 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
430 else
1
e78566595089 initial import
mandel
parents:
diff changeset
431 {
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
432 mixin("alias void delegate" ~ getFunc!_Tuple(fullName) ~ " Dg;");
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
433 alias ParameterTypeTuple!(Dg) ArgTypes;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
434 enum args = getFunc!_Args(fullName);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
435 enum defVals = defaultValues(args);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
436 enum defValsLength = defaultValuesLength(defVals);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
437
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
438 static if (metaPrefix == signalPrefix)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
439 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
440 // calculating local index of the signal
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
441 static if (typeof(this).stringof == "QObject")
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
442 enum localIndex = index;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
443 else
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
444 mixin ("enum localIndex = index - 1 - lastSignalIndex_" ~ (typeof(super)).stringof ~ ";");
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
445
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
446 static if (signalType == SignalType.NewSignal)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
447 {
302
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
448 pragma (msg, SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex));
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
449 mixin (SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex));
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
450 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
451 }
289
c9d1aac290e9 clean up of unneeded functionality
eldar
parents: 288
diff changeset
452 mixin InsertMetaMethod!(fullName, metaPrefix, index, defValsLength, ArgTypes);
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
453 // pragma (msg, ctfe_meta_signal!(ArgTypes)(fullName, index, defValsLength));
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
454 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
455 }
289
c9d1aac290e9 clean up of unneeded functionality
eldar
parents: 288
diff changeset
456 template InsertMetaMethod(string fullName, string metaPrefix, int index, int defValsCount, ArgTypes...)
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
457 {
289
c9d1aac290e9 clean up of unneeded functionality
eldar
parents: 288
diff changeset
458 static if(defValsCount >= 0)
c9d1aac290e9 clean up of unneeded functionality
eldar
parents: 288
diff changeset
459 mixin("public alias TypeTuple!(\"" ~ getFunc!_Name(fullName) ~ "\", index, typeof(this), ArgTypes) " ~ metaPrefix ~ toStringNow!(index) ~ ";");
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
460 static if(defValsCount > 0)
289
c9d1aac290e9 clean up of unneeded functionality
eldar
parents: 288
diff changeset
461 mixin InsertMetaMethod!(fullName, metaPrefix, index+1, defValsCount-1, ArgTypes[0..$-1]);
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
462 }
1
e78566595089 initial import
mandel
parents:
diff changeset
463
e78566595089 initial import
mandel
parents:
diff changeset
464
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
465 string signature_impl(T...)(string name)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
466 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
467 string res = name ~ "(";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
468 foreach(i, _; T)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
469 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
470 if(i > 0)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
471 res ~= ",";
302
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
472 static if (isNativeType!(T[i]))
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
473 res ~= Unqual!(T[i]).stringof;
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
474 else
55ee4603365d string arguments for signals
eldar_ins@eldar-laptop
parents: 293
diff changeset
475 res ~= T[i].stringof;
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
476 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
477 res ~= ")";
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
478 return res;
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
479 }
1
e78566595089 initial import
mandel
parents:
diff changeset
480
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
481 template signature(string name, T...)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
482 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
483 enum signature = signature_impl!(T)(name);
1
e78566595089 initial import
mandel
parents:
diff changeset
484 }
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
485
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
486 template lastSignalIndex(T)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
487 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
488 static if (T.stringof == "QObject")
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
489 enum lastSignalIndex = lastSignalIndexImpl!(T, 0);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
490 else
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
491 mixin ("enum lastSignalIndex = lastSignalIndexImpl!(T, " ~ "T.lastSignalIndex_" ~ (BaseClassesTuple!(T)[0]).stringof ~ ");");
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
492 }
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
493
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
494 template lastSignalIndexImpl(T, int index)
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
495 {
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
496 static if (is(typeof(mixin("T." ~ signalPrefix ~ toStringNow!(index)))))
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
497 enum lastSignalIndexImpl = lastSignalIndexImpl!(T, index + 1);
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
498 else
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
499 enum lastSignalIndexImpl = index - 1;
319
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
500 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
501
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
502 // ------------------------------------------------------------------
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
503
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
504 string[] getSymbols(C)(string prefix)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
505 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
506 string[] result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
507 auto allSymbols = __traits(derivedMembers, C);
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
508 foreach(s; allSymbols)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
509 if(ctfeStartsWith(s, prefix))
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
510 result ~= s;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
511 return result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
512 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
513
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
514 string removePrefix(string source)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
515 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
516 foreach (i, c; source)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
517 if (c == '_')
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
518 return source[i+1..$];
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
519 return source;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
520 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
521
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
522 template Alias(T...)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
523 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
524 alias T Alias;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
525 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
526
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
527 // recursive search in the static meta-information
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
528 template findSymbolsImpl2(C, alias signals, int id)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
529 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
530 alias Alias!(__traits(getOverloads, C, signals[id])) current;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
531 static if (signals.length - id - 1 > 0)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
532 alias TypeTuple!(current, findSymbolsImpl2!(C, signals, id + 1).result) result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
533 else
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
534 alias current result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
535 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
536
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
537 template findSymbols2(C, string prefix)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
538 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
539 enum signals = getSymbols!(C)(prefix);
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
540 static if (signals)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
541 alias findSymbolsImpl2!(C, signals, 0).result result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
542 else
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
543 alias TypeTuple!() result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
544 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
545
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
546 template findSignals(C)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
547 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
548 alias findSymbols2!(C, "signal_").result findSignals;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
549 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
550
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
551 template findSlots(C)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
552 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
553 alias findSymbols2!(C, "slot_").result findSlots;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
554 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
555
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
556
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
557 template metaMethods(alias func, int index, int defValsCount)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
558 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
559 static if(defValsCount >= 0) {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
560 alias TupleWrapper!(func, index) current;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
561 // pragma(msg, __traits(identifier, (current.at)[0]) ~ " " ~ typeof(&(current.at)[0]).stringof);
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
562 alias metaMethods!(func, index+1, defValsCount-1).result next;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
563 alias TypeTuple!(current, next) result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
564 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
565 else
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
566 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
567 alias TypeTuple!() result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
568 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
569 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
570
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
571 template toMetaEntriesImpl(int id, Methods...)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
572 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
573 static if (Methods.length > id)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
574 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
575 alias typeof(&Methods[id]) Fn;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
576 // enum defValsLength = 0; //ParameterTypeTuple!(Fn).length - requiredArgCount!(Methods[id])();
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
577 // pragma(msg, __traits(identifier, Methods[id]) ~ " " ~ typeof(&Methods[id]).stringof);
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
578 // alias metaMethods!(Methods[id], 0, defValsLength).result subres;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
579 alias TupleWrapper!(removePrefix(__traits(identifier, Methods[id])), typeof(&Methods[id])) subres;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
580 alias TypeTuple!(subres, toMetaEntriesImpl!(id+1, Methods).result) result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
581 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
582 else
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
583 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
584 alias TypeTuple!() result;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
585 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
586 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
587
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
588 template toMetaEntries(Methods...)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
589 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
590 alias TupleWrapper!(toMetaEntriesImpl!(0, Methods).result) toMetaEntries;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
591 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
592
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
593
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
594 bool printRawFuncs(T...)()
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
595 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
596 pragma(msg, "---Raw---");
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
597 foreach(i, _; T)
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
598 pragma(msg, __traits(identifier, T[i]) ~ " " ~ typeof(&T[i]).stringof);
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
599 return true;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
600 }
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
601
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
602
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
603 bool printFuncs(alias T)()
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
604 {
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
605 pragma(msg, "---MetaEntries---");
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
606 alias T.at tuple;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
607 enum num = tuple.length;
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
608 foreach(i, _; Repeat!(void, num))
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
609 pragma(msg, tuple[i].at[0] ~ " " ~ tuple[i].at[1].stringof);
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
610 // pragma(msg, typeof(&tuple[i].at[0]).stringof ~ " " ~ __toString(tuple[i].at[1]));
894d40eb89b6 new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents: 318
diff changeset
611 return true;
288
f9559a957be9 new signals and slots implementation
eldar
parents: 284
diff changeset
612 }