Mercurial > projects > qtd
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 |
rev | line source |
---|---|
1 | 1 /** |
2 * | |
3 * Copyright: Copyright QtD Team, 2008-2009 | |
4 * Authors: Max Samukha, Eldar Insafutdinov | |
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> | |
6 * | |
7 * Copyright QtD Team, 2008-2009 | |
8 * Distributed under the Boost Software License, Version 1.0. | |
9 * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
10 * | |
11 */ | |
16 | 12 module qt.Signal; |
1 | 13 |
14 public import qt.QGlobal; | |
288 | 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 | 17 |
1 | 18 import core.stdc.stdlib : crealloc = realloc, cfree = free; |
19 import core.stdc.string : memmove; | |
20 import | |
188 | 21 core.thread, |
288 | 22 core.exception, |
23 std.algorithm; | |
1 | 24 |
288 | 25 public import |
26 std.typetuple, | |
27 std.traits, | |
28 std.conv, | |
29 std.string, | |
30 std.metastrings; | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
31 |
288 | 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 | 39 enum {_Name, _Tuple, _Args} |
40 string getFunc(int type)(string fullName) | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
41 { |
288 | 42 int pos = 0; |
43 foreach(i, c; fullName) | |
44 if (c == '(') | |
45 static if (type == _Tuple) | |
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 | 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 | 51 if(fullName[j] == ')') |
52 return fullName[i+1 .. j]; | |
53 return null; | |
253 | 54 } |
1 | 55 |
288 | 56 /** The beast that takes string representation of function arguments |
57 * and returns an array of default values it doesn't check if arguments | |
58 * without default values follow the arguments with default values for | |
59 * simplicity. It is done by mixing in an delegate alias. | |
60 */ | |
61 string[] defaultValues(string signature) | |
1 | 62 { |
288 | 63 int braces = 0; |
64 bool inDefaultValue = false; | |
65 bool inStringLiteral = false; | |
66 string[] res; | |
67 int startValue = 0; | |
68 | |
69 if(strip(signature).length == 0) | |
70 return res; | |
1 | 71 |
288 | 72 foreach (i,c; signature) |
1 | 73 { |
288 | 74 if(!inStringLiteral) |
1 | 75 { |
288 | 76 if(c == '{' || c =='(') |
77 braces++; | |
78 else if(c == '}' || c ==')') | |
79 braces--; | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
80 } |
1 | 81 |
288 | 82 if(c == '\"' || c == '\'') |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
83 { |
288 | 84 if (inStringLiteral) |
85 { | |
86 if(signature[i-1] != '\\') | |
87 inStringLiteral = false; | |
88 } | |
89 else | |
90 { | |
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 | 95 if (!inStringLiteral && braces == 0) |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
96 { |
288 | 97 if(c == '=') // found default value |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
98 { |
288 | 99 inDefaultValue = true; |
100 startValue = i+1; | |
101 } | |
102 else if(c == ',') // next function argument | |
103 { | |
104 if (inDefaultValue) | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
105 { |
288 | 106 res ~= signature[startValue..i]; |
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 | 113 if (inDefaultValue) |
114 res ~= signature[startValue..$]; | |
1 | 115 |
288 | 116 return res; |
1 | 117 } |
118 | |
288 | 119 int defaultValuesLength(string[] defVals) |
1 | 120 { |
288 | 121 return defVals.length; |
1 | 122 } |
123 | |
124 /** | |
278 | 125 New implementation. |
126 */ | |
127 | |
288 | 128 |
129 | |
130 // templates for extracting data from static meta-information of signals, slots or properties | |
289 | 131 // public alias TypeTuple!("name", index, OwnerClass, ArgTypes) __signal |
288 | 132 template MetaEntryName(source...) |
133 { | |
134 enum MetaEntryName = source[0]; // name of the metaentry is the first element | |
135 } | |
136 | |
137 template MetaEntryOwner(source...) | |
138 { | |
139 alias TupleWrapper!(source[2]).at[0] MetaEntryOwner; // class that owns the property is the third | |
140 // Compiler #BUG 3092 - evaluates MetaEntryOwner as a Tuple with one element | |
141 } | |
142 | |
143 template MetaEntryArgs(source...) | |
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 | 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 | 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 | 153 } |
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 | 164 |
165 string joinArgs(A...)() | |
166 { | |
167 string res = ""; | |
168 static if(A.length) | |
169 { | |
170 res = A[0].stringof; | |
171 foreach(k; A[1..$]) | |
172 res ~= "," ~ k.stringof; | |
173 } | |
174 return res; | |
175 } | |
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 | 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 | 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 | 215 } |
216 } | |
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 | 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 | 240 template ByOwner(Owner) |
241 { | |
242 template ByOwner(source...) | |
243 { | |
244 enum ByOwner = is(MetaEntryOwner!source == Owner); | |
245 } | |
246 } | |
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 | 251 } |
252 | |
253 template signatureString(string name, A...) | |
254 { | |
255 const string signatureString = name ~ "(" ~ joinArgs!(A) ~ ")"; | |
256 } | |
257 | |
288 | 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 | 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 | 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 | 265 alias current result; |
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 | 268 } |
269 else | |
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 | 272 } |
273 } | |
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 | 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 | 298 } |
299 | |
288 | 300 // recursive search in the static meta-information |
301 template findSymbolsImpl(string prefix, C, int id, alias pred) | |
302 { | |
303 static if ( is(typeof(mixin("C." ~ staticSymbolName!(prefix, id)))) ) | |
304 { | |
305 mixin ("alias C." ~ staticSymbolName!(prefix, id) ~ " current;"); | |
306 static if (pred!current) { | |
307 alias TupleWrapper!current subres; | |
308 // pragma(msg, toStringNow!id ~ " " ~ subres.stringof); | |
309 } else | |
310 alias TypeTuple!() subres; | |
311 alias TypeTuple!(subres, findSymbolsImpl!(prefix, C, id + 1, pred).result) result; | |
312 } | |
313 else | |
314 { | |
315 alias TypeTuple!() result; | |
316 } | |
317 } | |
318 | |
319 template findSymbols(string prefix, C, alias pred) | |
320 { | |
321 alias findSymbolsImpl!(prefix, C, 0, pred).result findSymbols; | |
322 } | |
323 | |
324 string convertSignalArguments(Args...)() | |
325 { | |
326 // void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; | |
302 | 327 // at least for string argument need to construct a QString value |
328 string res = prepareSignalArguments!(Args); | |
329 | |
330 res ~= "void*[" ~ __toString(Args.length+1) ~ "] _a = [null"; | |
288 | 331 foreach(i, _; Args) |
318 | 332 res ~= ", " ~ "cast(void*) " ~ convertSignalArgument!(Args[i])("_t" ~ __toString(i)); |
288 | 333 res ~= "];\n"; |
334 return res; | |
335 } | |
336 | |
337 public string SignalEmitter(A...)(SignalType signalType, string name, string[] defVals, int localIndex) | |
284 | 338 { |
339 string fullArgs, args; | |
288 | 340 int defValsLength = defVals.length; |
341 string argsConversion = ""; | |
342 string argsPtr = "null"; | |
284 | 343 static if (A.length) |
344 { | |
288 | 345 while(A.length != defVals.length) |
346 defVals = "" ~ defVals; | |
347 | |
348 fullArgs = A[0].stringof ~ " _t0"; | |
349 if (defVals[0].length) | |
350 fullArgs ~= " = " ~ defVals[0]; | |
351 args = "_t0"; | |
284 | 352 foreach(i, _; A[1..$]) |
353 { | |
288 | 354 fullArgs ~= ", " ~ A[i+1].stringof ~ " _t" ~ __toString(i+1); |
355 if (defVals[i+1].length) | |
356 fullArgs ~= " = " ~ defVals[i+1]; | |
357 args ~= ", _t" ~ __toString(i+1); | |
284 | 358 } |
288 | 359 // build up conversion of signal args from D to C++ |
360 argsPtr = "_a.ptr"; | |
361 argsConversion = convertSignalArguments!(A)(); | |
284 | 362 } |
363 string attribute; | |
364 string sigName = name; | |
365 if (signalType == SignalType.BindQtSignal) | |
366 name ~= "_emit"; | |
367 else | |
368 attribute = "protected "; | |
288 | 369 |
370 string indexArgs = __toString(localIndex); | |
371 if(defValsLength > 0) | |
372 indexArgs ~= ", " ~ __toString(localIndex+defValsLength); | |
373 string str = attribute ~ "final void " ~ name ~ "(" ~ fullArgs ~ ") {\n" ~ argsConversion ~ "\n" | |
374 ~ " QMetaObject.activate(this, typeof(this).staticMetaObject, " ~ indexArgs ~ ", " ~ argsPtr ~ ");\n" | |
375 ~ "}\n"; // ~ | |
284 | 376 return str; |
377 } | |
278 | 378 /** ---------------- */ |
379 | |
380 | |
288 | 381 const string signalPrefix = "__signal"; |
382 const string slotPrefix = "__slot"; | |
284 | 383 |
384 enum SignalType | |
1 | 385 { |
284 | 386 BindQtSignal, |
288 | 387 NewSignal, |
388 NewSlot | |
284 | 389 } |
390 | |
288 | 391 template BindQtSignal(string fullName) |
1 | 392 { |
288 | 393 mixin MetaMethodImpl!(signalPrefix, 0, fullName, SignalType.BindQtSignal); |
1 | 394 } |
395 | |
288 | 396 template Signal(string fullName) |
1 | 397 { |
288 | 398 mixin MetaMethodImpl!(signalPrefix, 0, fullName, SignalType.NewSignal); |
399 } | |
1 | 400 |
288 | 401 template Slot(string fullName) |
402 { | |
403 mixin MetaMethodImpl!(slotPrefix, 0, fullName, SignalType.NewSlot); | |
1 | 404 } |
405 | |
288 | 406 template SignalImpl(int index, string fullName, SignalType signalType) |
1 | 407 { |
288 | 408 static if (is(typeof(mixin(typeof(this).stringof ~ "." ~ signalPrefix ~ ToString!(index))))) |
409 mixin SignalImpl!(index + 1, fullName, signalType); | |
410 else | |
1 | 411 { |
288 | 412 // pragma(msg, "alias void delegate" ~ getFunc!_Tuple(fullName) ~ " Dg;"); |
413 mixin("alias void delegate" ~ getFunc!_Tuple(fullName) ~ " Dg;"); | |
414 alias ParameterTypeTuple!(Dg) ArgTypes; | |
415 enum args = getFunc!_Args(fullName); | |
416 enum defVals = defaultValues(args); | |
417 enum defValsLength = defaultValuesLength(defVals); | |
1 | 418 |
288 | 419 // pragma (msg, SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, index)); |
420 mixin InsertMetaSignal!(fullName, index, defValsLength, ArgTypes); | |
421 // pragma (msg, ctfe_meta_signal!(ArgTypes)(fullName, index, defValsLength)); | |
422 } | |
423 } | |
424 template MetaMethodImpl(string metaPrefix, int index, string fullName, SignalType signalType) | |
425 { | |
426 static if (is(typeof(mixin(typeof(this).stringof ~ "." ~ metaPrefix ~ toStringNow!(index))))) | |
427 { | |
428 mixin MetaMethodImpl!(metaPrefix, index + 1, fullName, signalType); | |
429 } | |
430 else | |
1 | 431 { |
288 | 432 mixin("alias void delegate" ~ getFunc!_Tuple(fullName) ~ " Dg;"); |
433 alias ParameterTypeTuple!(Dg) ArgTypes; | |
434 enum args = getFunc!_Args(fullName); | |
435 enum defVals = defaultValues(args); | |
436 enum defValsLength = defaultValuesLength(defVals); | |
437 | |
438 static if (metaPrefix == signalPrefix) | |
439 { | |
440 // calculating local index of the signal | |
441 static if (typeof(this).stringof == "QObject") | |
442 enum localIndex = index; | |
443 else | |
444 mixin ("enum localIndex = index - 1 - lastSignalIndex_" ~ (typeof(super)).stringof ~ ";"); | |
445 | |
446 static if (signalType == SignalType.NewSignal) | |
447 { | |
302 | 448 pragma (msg, SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex)); |
288 | 449 mixin (SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex)); |
450 } | |
451 } | |
289 | 452 mixin InsertMetaMethod!(fullName, metaPrefix, index, defValsLength, ArgTypes); |
288 | 453 // pragma (msg, ctfe_meta_signal!(ArgTypes)(fullName, index, defValsLength)); |
454 } | |
455 } | |
289 | 456 template InsertMetaMethod(string fullName, string metaPrefix, int index, int defValsCount, ArgTypes...) |
288 | 457 { |
289 | 458 static if(defValsCount >= 0) |
459 mixin("public alias TypeTuple!(\"" ~ getFunc!_Name(fullName) ~ "\", index, typeof(this), ArgTypes) " ~ metaPrefix ~ toStringNow!(index) ~ ";"); | |
288 | 460 static if(defValsCount > 0) |
289 | 461 mixin InsertMetaMethod!(fullName, metaPrefix, index+1, defValsCount-1, ArgTypes[0..$-1]); |
288 | 462 } |
1 | 463 |
464 | |
288 | 465 string signature_impl(T...)(string name) |
466 { | |
467 string res = name ~ "("; | |
468 foreach(i, _; T) | |
469 { | |
470 if(i > 0) | |
471 res ~= ","; | |
302 | 472 static if (isNativeType!(T[i])) |
473 res ~= Unqual!(T[i]).stringof; | |
474 else | |
475 res ~= T[i].stringof; | |
288 | 476 } |
477 res ~= ")"; | |
478 return res; | |
479 } | |
1 | 480 |
288 | 481 template signature(string name, T...) |
482 { | |
483 enum signature = signature_impl!(T)(name); | |
1 | 484 } |
288 | 485 |
486 template lastSignalIndex(T) | |
487 { | |
488 static if (T.stringof == "QObject") | |
489 enum lastSignalIndex = lastSignalIndexImpl!(T, 0); | |
490 else | |
491 mixin ("enum lastSignalIndex = lastSignalIndexImpl!(T, " ~ "T.lastSignalIndex_" ~ (BaseClassesTuple!(T)[0]).stringof ~ ");"); | |
492 } | |
493 | |
494 template lastSignalIndexImpl(T, int index) | |
495 { | |
496 static if (is(typeof(mixin("T." ~ signalPrefix ~ toStringNow!(index))))) | |
497 enum lastSignalIndexImpl = lastSignalIndexImpl!(T, index + 1); | |
498 else | |
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 | 612 } |