Mercurial > projects > qtd
annotate qt/d2/qt/Signal.d @ 339:4e31cbd9e20c
fix enumeration problems. requires patched dmd
author | Eldar Insafutdinov |
---|---|
date | Sun, 09 May 2010 00:52:49 +0100 |
parents | 7a3c43424dca |
children |
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) |
323
7a3c43424dca
make all examples compile with new signals/slots
eldar_ins@eldar-laptop
parents:
322
diff
changeset
|
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 | |
322
7c2cf27391c4
A slight change of the connect syntax. More sofisticated signals/slots lookup. Some fixes in examples.
eldar_ins@eldar-laptop
parents:
321
diff
changeset
|
189 string signature(T...)(string name) |
288 | 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 |
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
|
205 // ------------------------------------------------------------------ |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
206 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
207 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
|
208 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 } |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
216 |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
217 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
|
218 { |
894d40eb89b6
new signals and slots syntax. have to use prefixes now: signal_fooed and slot_onFooed
eldar_ins@eldar-laptop
parents:
318
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 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
|
223 } |
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 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
|
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 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
|
228 } |
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 // 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
|
231 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
|
232 { |
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 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 } |
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 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
|
241 { |
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 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
|
243 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
|
244 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
|
245 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
|
246 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
|
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 |
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 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
|
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 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
|
252 } |
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 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
|
255 { |
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 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
|
257 } |
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 |
320 | 259 /* 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
|
260 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
|
261 { |
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 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
|
263 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
|
264 // 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
|
265 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
|
266 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
|
267 } |
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 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
|
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 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
|
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 } |
320 | 273 */ |
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
|
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 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
|
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 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
|
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 alias typeof(&Methods[id]) Fn; |
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 // 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
|
282 // 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
|
283 // 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
|
284 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
|
285 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
|
286 } |
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 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
|
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 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
|
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 } |
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 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
|
294 { |
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 alias TupleWrapper!(toMetaEntriesImpl!(0, Methods).result) toMetaEntries; |
339
4e31cbd9e20c
fix enumeration problems. requires patched dmd
Eldar Insafutdinov
parents:
323
diff
changeset
|
296 } |