comparison qt/d2/qt/Signal.d @ 289:c9d1aac290e9 signals

clean up of unneeded functionality
author eldar
date Mon, 09 Nov 2009 06:54:04 +0000
parents f9559a957be9
children 8627891e4556
comparison
equal deleted inserted replaced
288:f9559a957be9 289:c9d1aac290e9
118 /** 118 /**
119 New implementation. 119 New implementation.
120 */ 120 */
121 121
122 122
123 // need this to mark static metamethods-info whether it's generated by presence of default args
124 enum DefaultArgs
125 {
126 None, Start, Continue
127 }
128 123
129 // templates for extracting data from static meta-information of signals, slots or properties 124 // templates for extracting data from static meta-information of signals, slots or properties
130 // public alias TypeTuple!("name", index, OwnerClass, DefaultArgs.Start, ArgTypes) __signal 125 // public alias TypeTuple!("name", index, OwnerClass, ArgTypes) __signal
131 template MetaEntryName(source...) 126 template MetaEntryName(source...)
132 { 127 {
133 enum MetaEntryName = source[0]; // name of the metaentry is the first element 128 enum MetaEntryName = source[0]; // name of the metaentry is the first element
134 } 129 }
135 130
139 // Compiler #BUG 3092 - evaluates MetaEntryOwner as a Tuple with one element 134 // Compiler #BUG 3092 - evaluates MetaEntryOwner as a Tuple with one element
140 } 135 }
141 136
142 template MetaEntryArgs(source...) 137 template MetaEntryArgs(source...)
143 { 138 {
144 alias source[4 .. $] MetaEntryArgs; // arguments-tuple starts from the fourth position 139 alias source[3 .. $] MetaEntryArgs; // arguments-tuple starts from the fourth position
145 } 140 }
146 141
147 template TupleWrapper(A...) { alias A at; } 142 template TupleWrapper(A...) { alias A at; }
148 143
149 template isDg(Dg) 144 template isDg(Dg)
470 { 465 {
471 pragma (msg, SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex)); 466 pragma (msg, SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex));
472 mixin (SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex)); 467 mixin (SignalEmitter!(ArgTypes)(SignalType.NewSignal, getFunc!_Name(fullName), defVals, localIndex));
473 } 468 }
474 } 469 }
475 mixin InsertMetaMethod!(fullName, metaPrefix, index, defValsLength, DefaultArgs.Start, ArgTypes); 470 mixin InsertMetaMethod!(fullName, metaPrefix, index, defValsLength, ArgTypes);
476 // pragma (msg, ctfe_meta_signal!(ArgTypes)(fullName, index, defValsLength)); 471 // pragma (msg, ctfe_meta_signal!(ArgTypes)(fullName, index, defValsLength));
477 } 472 }
478 } 473 }
479 template InsertMetaMethod(string fullName, string metaPrefix, int index, int defValsCount, DefaultArgs defArgsInitFlag, ArgTypes...) 474 template InsertMetaMethod(string fullName, string metaPrefix, int index, int defValsCount, ArgTypes...)
480 { 475 {
481 // this identifies if metamethod is was generated by the presence of default args or not 476 static if(defValsCount >= 0)
477 mixin("public alias TypeTuple!(\"" ~ getFunc!_Name(fullName) ~ "\", index, typeof(this), ArgTypes) " ~ metaPrefix ~ toStringNow!(index) ~ ";");
482 static if(defValsCount > 0) 478 static if(defValsCount > 0)
483 { 479 mixin InsertMetaMethod!(fullName, metaPrefix, index+1, defValsCount-1, ArgTypes[0..$-1]);
484 static if (defArgsInitFlag == DefaultArgs.Start)
485 enum defValsFlag = DefaultArgs.Start;
486 else
487 enum defValsFlag = DefaultArgs.Continue;
488 }
489 else
490 {
491 static if (defArgsInitFlag == DefaultArgs.Start)
492 enum defValsFlag = DefaultArgs.None;
493 else
494 enum defValsFlag = DefaultArgs.Continue;
495 }
496 static if(defValsCount >= 0)
497 mixin("public alias TypeTuple!(\"" ~ getFunc!_Name(fullName) ~ "\", index, typeof(this), defValsFlag, ArgTypes) " ~ metaPrefix ~ toStringNow!(index) ~ ";");
498 static if(defValsCount > 0)
499 mixin InsertMetaMethod!(fullName, metaPrefix, index+1, defValsCount-1, DefaultArgs.Continue, ArgTypes[0..$-1]);
500 } 480 }
501 481
502 482
503 string signature_impl(T...)(string name) 483 string signature_impl(T...)(string name)
504 { 484 {