comparison generator/containergenerator.cpp @ 248:7664de4a55e5

Fixed #23. QtD_QObjectEntity is not created dynamically for shell classes any more. Class initialization is now performed by static constructors. When wrapping QObjects returned from functions, their run-time types are now taken into account. QObjects are allocated on GC heap, a doubly-linked list is used to prevent them from been collected (arguably a better solution than allocating on C heap and adding GC ranges) Minor changes (including unnecessary).
author maxter
date Thu, 20 Aug 2009 14:47:17 +0000
parents d69b58c01131
children 37eed70de029
comparison
equal deleted inserted replaced
247:27497bbe62a1 248:7664de4a55e5
445 cpp_type = "void*"; 445 cpp_type = "void*";
446 cpp_assign_type = cpp_type + "*"; 446 cpp_assign_type = cpp_type + "*";
447 d_type = cls_name; 447 d_type = cls_name;
448 if (centry->designatedInterface()) 448 if (centry->designatedInterface())
449 d_type = centry->designatedInterface()->name(); 449 d_type = centry->designatedInterface()->name();
450 nativeId = ".nativeId"; 450 nativeId = ".__nativeId";
451 } 451 }
452 452
453 if (centry->designatedInterface()) { 453 if (centry->designatedInterface()) {
454 type_name = centry->designatedInterface()->name(); 454 type_name = centry->designatedInterface()->name();
455 nativeId = ".__ptr_" + type_name; 455 nativeId = ".__ptr_" + type_name;
468 << "private extern(C) void qtd_get_" << cls_name << "_from_array(" << type_name << "* arr, size_t pos, " << cpp_assign_type << " elem)" << endl 468 << "private extern(C) void qtd_get_" << cls_name << "_from_array(" << type_name << "* arr, size_t pos, " << cpp_assign_type << " elem)" << endl
469 << "{" << endl 469 << "{" << endl
470 << INDENT << "*elem = arr[pos]" << nativeId << ";" << endl 470 << INDENT << "*elem = arr[pos]" << nativeId << ";" << endl
471 << "}" << endl << endl 471 << "}" << endl << endl
472 472
473 << "package " << d_type << " qtd_" << cls_name << "_cpp_to_d(" << cpp_type << " __qt_return_value)" << endl 473 << "package " << d_type << " qtd_" << cls_name << "_cpp_to_d(" << cpp_type << " ret)" << endl
474 << "{" << endl; 474 << "{" << endl;
475 475
476 marshallFromCppToD(s, centry); 476 marshallFromCppToD(s, centry);
477 477
478 s << "}" << endl; 478 s << "}" << endl;