QString GeneratorSetD::generate() { // Ui conversion... if (do_ui_convert) { UiConverter converter; converter.setClasses(builder.classes()); converter.convertToJui(ui_file_name, custom_widgets); return 0; } else if (!custom_widgets.isEmpty()) { fprintf(stderr, "NOTE: The --custom-widgets option only has an effect when used with --convert-to-jui"); } // Code generation QList<Generator *> generators; PriGenerator *priGenerator = new PriGenerator; ContainerGenerator *cointainerGenerator; DGenerator *d_generator = 0; CppHeaderGenerator *cpp_header_generator = 0; CppImplGenerator *cpp_impl_generator = 0; MetaInfoGenerator *metainfo = 0; JumpTablePreprocessor *jumpTablePreprocessor = 0; JumpTableGenerator *jumpTableGenerator = 0; ClassFromEntry::construct(builder.classes()); QStringList contexts; if (build_qdoc_japi) { generators << new QDocGenerator; contexts << "QDocGenerator"; } if (native_jump_table) { jumpTablePreprocessor = new JumpTablePreprocessor(); generators << jumpTablePreprocessor; contexts << "JumpTablePreprocessor"; } if (!no_d) { d_generator = new DGenerator; d_generator->setDocumentationDirectory(doc_dir); d_generator->setDocumentationEnabled(docs_enabled); d_generator->setNativeJumpTable(native_jump_table); generators << d_generator; contexts << "JavaGenerator"; } if (!no_cpp_h) { cpp_header_generator = new CppHeaderGenerator(priGenerator); generators << cpp_header_generator; contexts << "CppHeaderGenerator"; } if (!no_cpp_impl) { cpp_impl_generator = new CppImplGenerator(priGenerator); cpp_impl_generator->setNativeJumpTable(native_jump_table); generators << cpp_impl_generator; contexts << "CppImplGenerator"; } if (native_jump_table) { jumpTableGenerator = new JumpTableGenerator(jumpTablePreprocessor, priGenerator); generators << jumpTableGenerator; contexts << "JumpTableGenerator"; } if (!no_metainfo) { metainfo = new MetaInfoGenerator(priGenerator); generators << metainfo; contexts << "MetaInfoGenerator"; } if (build_class_list) { generators << new ClassListGenerator; contexts << "ClassListGenerator"; } cointainerGenerator = new ContainerGenerator(cpp_impl_generator); generators << priGenerator; contexts << "PriGenerator"; generators << cointainerGenerator; contexts << "cointainerGenerator"; for (int i=0; i<generators.size(); ++i) { Generator *generator = generators.at(i); ReportHandler::setContext(contexts.at(i)); generator->setOutputDirectory(outDir); generator->setClasses(builder.classes()); if (printStdout) generator->printClasses(); else generator->generate(); } QString res; res = QString("Classes in typesystem: %1\n" "Generated:\n" " - d.........: %2 (%3)\n" " - cpp-impl..: %4 (%5)\n" " - cpp-h.....: %6 (%7)\n" " - meta-info.: %8 (%9)\n" " - pri.......: %10 (%11)\n" ) .arg(builder.classes().size()) .arg(d_generator ? d_generator->numGenerated() : 0) .arg(d_generator ? d_generator->numGeneratedAndWritten() : 0) .arg(cpp_impl_generator ? cpp_impl_generator->numGenerated() : 0) .arg(cpp_impl_generator ? cpp_impl_generator->numGeneratedAndWritten() : 0) .arg(cpp_header_generator ? cpp_header_generator->numGenerated() : 0) .arg(cpp_header_generator ? cpp_header_generator->numGeneratedAndWritten() : 0) .arg(metainfo ? metainfo->numGenerated() : 0) .arg(metainfo ? metainfo->numGeneratedAndWritten() : 0) .arg(priGenerator->numGenerated()) .arg(priGenerator->numGeneratedAndWritten()); return res; }
QString GeneratorSetDylan::generate() { // Code generation QList<Generator *> generators; LibraryGenerator *libraryGenerator = new LibraryGenerator; LidGenerator *lidGenerator = new LidGenerator; DylanGenerator *dylan_generator = 0; PlainCppHeaderGenerator *cpp_header_generator = 0; PlainCppImplGenerator *cpp_impl_generator = 0; QStringList contexts; dylan_generator = new DylanGenerator(libraryGenerator, lidGenerator); if (!javaOutDir.isNull()) dylan_generator->setDylanOutputDirectory(javaOutDir); if (!outDir.isNull()) dylan_generator->setLogOutputDirectory(outDir); generators << dylan_generator; contexts << "DylanGenerator"; cpp_header_generator = new PlainCppHeaderGenerator(lidGenerator); if (!cppOutDir.isNull()) cpp_header_generator->setCppOutputDirectory(cppOutDir); generators << cpp_header_generator; contexts << "PlainCppHeaderGenerator"; cpp_impl_generator = new PlainCppImplGenerator(lidGenerator); if (!cppOutDir.isNull()) cpp_impl_generator->setCppOutputDirectory(cppOutDir); generators << cpp_impl_generator; contexts << "PlainCppImplGenerator"; if (!cppOutDir.isNull()) lidGenerator->setCppOutputDirectory(cppOutDir); generators << lidGenerator; contexts << "LidGenerator"; if (!cppOutDir.isNull()) libraryGenerator->setOutputDirectory(cppOutDir); generators << libraryGenerator; contexts << "LibraryGenerator"; for (int i = 0; i < generators.size(); ++i) { Generator *generator = generators.at(i); ReportHandler::setContext(contexts.at(i)); if (generator->outputDirectory().isNull()) generator->setOutputDirectory(outDir); generator->setClasses(builder.classes()); if (printStdout) generator->printClasses(); else generator->generate(); } QString res; res = QString("Classes in typesystem: %1\n" "Generated:\n" " - dylan.....: %2 (%3)\n" " - cpp-impl..: %4 (%5)\n" " - cpp-h.....: %6 (%7)\n" " - library...: %8 (%9)\n" " - lid.......: %10 (%11)\n" ) .arg(builder.classes().size()) .arg(dylan_generator ? dylan_generator->numGenerated() : 0) .arg(dylan_generator ? dylan_generator->numGeneratedAndWritten() : 0) .arg(cpp_impl_generator ? cpp_impl_generator->numGenerated() : 0) .arg(cpp_impl_generator ? cpp_impl_generator->numGeneratedAndWritten() : 0) .arg(cpp_header_generator ? cpp_header_generator->numGenerated() : 0) .arg(cpp_header_generator ? cpp_header_generator->numGeneratedAndWritten() : 0) .arg(libraryGenerator->numGenerated()) .arg(libraryGenerator->numGeneratedAndWritten()) .arg(lidGenerator->numGenerated()) .arg(lidGenerator->numGeneratedAndWritten()); return res; }