comparison qt/qtd/MOC.d @ 322:7c2cf27391c4 signals

A slight change of the connect syntax. More sofisticated signals/slots lookup. Some fixes in examples.
author eldar_ins@eldar-laptop
date Sun, 27 Dec 2009 21:13:38 +0500
parents 5c6455c4889b
children 7a3c43424dca
comparison
equal deleted inserted replaced
321:d458ed66e871 322:7c2cf27391c4
421 421
422 string dDeclArgs(Args...)() 422 string dDeclArgs(Args...)()
423 { 423 {
424 string ret; 424 string ret;
425 foreach(i, _; Args) 425 foreach(i, _; Args)
426 ret ~= ", " ~ Args[i].stringof; 426 {
427 if (i > 0)
428 ret ~= ", ";
429 ret ~= Args[i].stringof;
430 }
427 return ret; 431 return ret;
428 } 432 }
429 string genMetaMethodsConstr(alias Funcs)(string className) 433 string genMetaMethodsConstr(alias Funcs)(string className)
430 { 434 {
431 string res; 435 string res;
432 enum funcsCount = Funcs.at.length; 436 enum funcsCount = Funcs.at.length;
433 foreach(i, bogus; Repeat!(void, funcsCount)) 437 foreach(i, bogus; Repeat!(void, funcsCount))
434 { 438 {
435 res ~= " index++;\n" ~ 439 res ~= " index++;\n" ~
436 " _staticMetaObject.addMethod(new " ~ className ~ "(signature!(\"" ~ MetaEntryName!(Funcs.at[i].at) ~ "\"" ~ dDeclArgs!(MetaEntryArgs!(Funcs.at[i].at))()~ "), index));\n\n"; 440 " _staticMetaObject.addMethod(new " ~ className ~ "(signature!(" ~ dDeclArgs!(MetaEntryArgs!(Funcs.at[i].at))()~ ")(\"" ~ MetaEntryName!(Funcs.at[i].at) ~ "\"), index));\n\n";
437 } 441 }
438 return res; 442 return res;
439 } 443 }
440 string generateMetaObjectConstruction(alias Signals, alias Slots)() 444 string generateMetaObjectConstruction(alias Signals, alias Slots)()
441 { 445 {
503 } 507 }
504 508
505 template Q_OBJECT_BIND() 509 template Q_OBJECT_BIND()
506 { 510 {
507 } 511 }
508 /* 512
509 template Q_OBJECT()
510 {
511 // pragma(msg, toStringNow!(lastSignalIndex!(typeof(this))));
512 mixin ("enum lastSignalIndex_" ~ typeof(this).stringof ~ " = " ~ toStringNow!(lastSignalIndex!(typeof(this))) ~ ";");
513
514 alias TupleWrapper!(findSymbols!(slotPrefix, typeof(this), ByOwner!(typeof(this)))) Slots;
515 alias TupleWrapper!(findSymbols!(signalPrefix, typeof(this), ByOwner!(typeof(this)))) Signals;
516 pragma(msg, generateMetaInfo!((typeof(this)).stringof, Signals, Slots)());
517 mixin(generateMetaInfo!((typeof(this)).stringof, Signals, Slots)());
518 }
519 */
520 // ------------------------------------------------------------------------------------------ 513 // ------------------------------------------------------------------------------------------
521 514
522 string generateSignalEmitters(alias Funcs)() 515 string generateSignalEmitters(alias Funcs)()
523 { 516 {
524 string res; 517 string res;