Mercurial > projects > qtd
annotate qt/d2/qt/Signal.d @ 321:d458ed66e871 signals
minor stuff
author | eldar_ins@eldar-laptop |
---|---|
date | Sat, 26 Dec 2009 05:10:16 +0500 |
parents | 5c6455c4889b |
children | 7c2cf27391c4 |
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.metastrings; | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
30 |
321 | 31 public import std.string : strip, toStringz; |
288 | 32 |
33 /** The beast that takes string representation of function arguments | |
34 * and returns an array of default values it doesn't check if arguments | |
35 * without default values follow the arguments with default values for | |
36 * simplicity. It is done by mixing in an delegate alias. | |
37 */ | |
38 string[] defaultValues(string signature) | |
1 | 39 { |
288 | 40 int braces = 0; |
41 bool inDefaultValue = false; | |
42 bool inStringLiteral = false; | |
43 string[] res; | |
44 int startValue = 0; | |
45 | |
46 if(strip(signature).length == 0) | |
47 return res; | |
1 | 48 |
288 | 49 foreach (i,c; signature) |
1 | 50 { |
288 | 51 if(!inStringLiteral) |
1 | 52 { |
288 | 53 if(c == '{' || c =='(') |
54 braces++; | |
55 else if(c == '}' || c ==')') | |
56 braces--; | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
57 } |
1 | 58 |
288 | 59 if(c == '\"' || c == '\'') |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
60 { |
288 | 61 if (inStringLiteral) |
62 { | |
63 if(signature[i-1] != '\\') | |
64 inStringLiteral = false; | |
65 } | |
66 else | |
67 { | |
68 inStringLiteral = true; | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
69 } |
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
70 } |
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
71 |
288 | 72 if (!inStringLiteral && braces == 0) |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
73 { |
288 | 74 if(c == '=') // found default value |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
75 { |
288 | 76 inDefaultValue = true; |
77 startValue = i+1; | |
78 } | |
79 else if(c == ',') // next function argument | |
80 { | |
81 if (inDefaultValue) | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
82 { |
288 | 83 res ~= signature[startValue..i]; |
84 inDefaultValue = false; | |
276
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
85 } |
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
86 } |
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
87 } |
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
88 } |
501128ac7a2c
signals cleaned up correctly on receiver destruction
maxter
parents:
268
diff
changeset
|
89 |
288 | 90 if (inDefaultValue) |
91 res ~= signature[startValue..$]; | |
1 | 92 |
288 | 93 return res; |
1 | 94 } |
95 | |
288 | 96 int defaultValuesLength(string[] defVals) |
1 | 97 { |
288 | 98 return defVals.length; |
1 | 99 } |
100 | |
288 | 101 |
102 // templates for extracting data from static meta-information of signals, slots or properties | |
289 | 103 // public alias TypeTuple!("name", index, OwnerClass, ArgTypes) __signal |
288 | 104 template MetaEntryName(source...) |
105 { | |
106 enum MetaEntryName = source[0]; // name of the metaentry is the first element | |
107 } | |
108 | |
109 template MetaEntryOwner(source...) | |
110 { | |
111 alias TupleWrapper!(source[2]).at[0] MetaEntryOwner; // class that owns the property is the third | |
112 // Compiler #BUG 3092 - evaluates MetaEntryOwner as a Tuple with one element | |
113 } | |
114 | |
115 template MetaEntryArgs(source...) | |
116 { | |
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
|
117 alias ParameterTypeTuple!(source[1]) MetaEntryArgs; // arguments-tuple starts from the fourth position |
288 | 118 } |
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
|
119 |
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
|
120 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
|
121 |
288 | 122 string convertSignalArguments(Args...)() |
123 { | |
124 // void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; | |
302 | 125 // at least for string argument need to construct a QString value |
126 string res = prepareSignalArguments!(Args); | |
127 | |
128 res ~= "void*[" ~ __toString(Args.length+1) ~ "] _a = [null"; | |
288 | 129 foreach(i, _; Args) |
318 | 130 res ~= ", " ~ "cast(void*) " ~ convertSignalArgument!(Args[i])("_t" ~ __toString(i)); |
288 | 131 res ~= "];\n"; |
132 return res; | |
133 } | |
134 | |
135 public string SignalEmitter(A...)(SignalType signalType, string name, string[] defVals, int localIndex) | |
284 | 136 { |
137 string fullArgs, args; | |
288 | 138 int defValsLength = defVals.length; |
139 string argsConversion = ""; | |
140 string argsPtr = "null"; | |
284 | 141 static if (A.length) |
142 { | |
288 | 143 while(A.length != defVals.length) |
144 defVals = "" ~ defVals; | |
145 | |
146 fullArgs = A[0].stringof ~ " _t0"; | |
147 if (defVals[0].length) | |
148 fullArgs ~= " = " ~ defVals[0]; | |
149 args = "_t0"; | |
284 | 150 foreach(i, _; A[1..$]) |
151 { | |
288 | 152 fullArgs ~= ", " ~ A[i+1].stringof ~ " _t" ~ __toString(i+1); |
153 if (defVals[i+1].length) | |
154 fullArgs ~= " = " ~ defVals[i+1]; | |
155 args ~= ", _t" ~ __toString(i+1); | |
284 | 156 } |
288 | 157 // build up conversion of signal args from D to C++ |
158 argsPtr = "_a.ptr"; | |
159 argsConversion = convertSignalArguments!(A)(); | |
284 | 160 } |
161 string attribute; | |
162 string sigName = name; | |
163 if (signalType == SignalType.BindQtSignal) | |
164 name ~= "_emit"; | |
165 else | |
166 attribute = "protected "; | |
288 | 167 |
168 string indexArgs = __toString(localIndex); | |
169 if(defValsLength > 0) | |
170 indexArgs ~= ", " ~ __toString(localIndex+defValsLength); | |
171 string str = attribute ~ "final void " ~ name ~ "(" ~ fullArgs ~ ") {\n" ~ argsConversion ~ "\n" | |
172 ~ " QMetaObject.activate(this, typeof(this).staticMetaObject, " ~ indexArgs ~ ", " ~ argsPtr ~ ");\n" | |
173 ~ "}\n"; // ~ | |
284 | 174 return str; |
175 } | |
278 | 176 /** ---------------- */ |
177 | |
178 | |
288 | 179 const string signalPrefix = "__signal"; |
180 const string slotPrefix = "__slot"; | |
284 | 181 |
182 enum SignalType | |
1 | 183 { |
284 | 184 BindQtSignal, |
288 | 185 NewSignal, |
186 NewSlot | |
284 | 187 } |
188 | |
288 | 189 string signature_impl(T...)(string name) |
190 { | |
191 string res = name ~ "("; | |
192 foreach(i, _; T) | |
193 { | |
194 if(i > 0) | |
195 res ~= ","; | |
302 | 196 static if (isNativeType!(T[i])) |
197 res ~= Unqual!(T[i]).stringof; | |
198 else | |
199 res ~= T[i].stringof; | |
288 | 200 } |
201 res ~= ")"; | |
202 return res; | |
203 } | |
1 | 204 |
288 | 205 template signature(string name, T...) |
206 { | |
207 enum signature = signature_impl!(T)(name); | |
1 | 208 } |
288 | 209 |
210 template lastSignalIndex(T) | |
211 { | |
212 static if (T.stringof == "QObject") | |
213 enum lastSignalIndex = lastSignalIndexImpl!(T, 0); | |
214 else | |
215 mixin ("enum lastSignalIndex = lastSignalIndexImpl!(T, " ~ "T.lastSignalIndex_" ~ (BaseClassesTuple!(T)[0]).stringof ~ ");"); | |
216 } | |
217 | |
218 template lastSignalIndexImpl(T, int index) | |
219 { | |
220 static if (is(typeof(mixin("T." ~ signalPrefix ~ toStringNow!(index))))) | |
221 enum lastSignalIndexImpl = lastSignalIndexImpl!(T, index + 1); | |
222 else | |
223 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
|
224 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
225 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
226 // ------------------------------------------------------------------ |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
227 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
228 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
|
229 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
237 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
238 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
|
239 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
240 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
|
241 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
|
242 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
|
243 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
|
244 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
245 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
246 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
|
247 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
248 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
|
249 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
250 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
251 // 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
|
252 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
|
253 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
260 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
261 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
|
262 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
263 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
|
264 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
|
265 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
|
266 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
|
267 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
|
268 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
269 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
270 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
|
271 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
272 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
|
273 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
274 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
275 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
|
276 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
277 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
|
278 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
279 |
320 | 280 /* commented out for future when we will implement default arguments |
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
|
281 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
|
282 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
283 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
|
284 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
|
285 // 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
|
286 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
|
287 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
|
288 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
289 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
|
290 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
291 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
|
292 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
293 } |
320 | 294 */ |
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
|
295 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
296 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
|
297 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
298 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
|
299 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
300 alias typeof(&Methods[id]) Fn; |
320 | 301 // commented out for future when we will implement default arguments |
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
|
302 // 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
|
303 // 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
|
304 // 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
|
305 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
|
306 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
|
307 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
308 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
|
309 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
310 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
|
311 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
312 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
313 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
314 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
|
315 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
316 alias TupleWrapper!(toMetaEntriesImpl!(0, Methods).result) toMetaEntries; |
288 | 317 } |