Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions generator/abstractmetabuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,7 @@ static void write_reject_log_file(const QString &name, const QString &tagName,


for (int reason=0; reason<AbstractMetaBuilder::NoReason; ++reason) {
s << QString(72, '*') << endl;
s << QString(72, '*') << Qt::endl;
switch (reason) {
case AbstractMetaBuilder::NotInTypeSystem:
s << "Not in type system";
Expand All @@ -2421,21 +2421,21 @@ static void write_reject_log_file(const QString &name, const QString &tagName,
break;
}

s << endl;
s << Qt::endl;

for (QMap<QString, AbstractMetaBuilder::RejectReason>::const_iterator it = rejects.constBegin();
it != rejects.constEnd(); ++it) {
if (it.value() != reason)
continue;
if (tagName.isEmpty()) {
s << it.key() << endl;
s << it.key() << Qt::endl;
} else {
s << "<" << tagName << " name=\"" << it.key() << "\"/>" << endl;
// s << "<rejection class=\"" << it.key() << "\"/>" << endl;
s << "<" << tagName << " name=\"" << it.key() << "\"/>" << Qt::endl;
// s << "<rejection class=\"" << it.key() << "\"/>" << Qt::endl;
}
}

s << QString(72, '*') << endl << endl;
s << QString(72, '*') << Qt::endl << Qt::endl;
}

}
Expand Down
2 changes: 1 addition & 1 deletion generator/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void Generator::printClasses()
if (!shouldGenerate(cls))
continue;
write(s, cls);
s << endl << endl;
s << Qt::endl << Qt::endl;
}
}

Expand Down
60 changes: 30 additions & 30 deletions generator/setupgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,18 @@ void SetupGenerator::generate()
ReportHandler::debugSparse(QString("generating: %1").arg(fileName));
QTextStream &s = initFile.stream;

s << "#include <PythonQt.h>" << endl;
s << "#include <PythonQtConversion.h>" << endl;
s << "#include <PythonQt.h>" << Qt::endl;
s << "#include <PythonQtConversion.h>" << Qt::endl;

for (int i=0; i<(list.count()+ maxClassesPerFile -1) / maxClassesPerFile; i++) {
s << "#include \"" << packKey << QString::number(i) << ".h\"" << endl;
s << "#include \"" << packKey << QString::number(i) << ".h\"" << Qt::endl;
}
s << endl;
s << Qt::endl;

QStringList polymorphicHandlers;
if (!isBuiltin) {
polymorphicHandlers = writePolymorphicHandler(s, list.at(0)->package(), classes_with_polymorphic_id, list);
s << endl;
s << Qt::endl;
}

QSet<QString> listRegistration;
Expand Down Expand Up @@ -320,14 +320,14 @@ void SetupGenerator::generate()
for (QString snip : snips) {
s << snip;
}
s << endl;
s << Qt::endl;

// declare individual class creation functions
s << "void PythonQt_init_" << initName << "(PyObject* module) {" << endl;
s << "void PythonQt_init_" << initName << "(PyObject* module) {" << Qt::endl;

for (const AbstractMetaClass* cls : list) {
if (cls->qualifiedCppName().contains("Ssl")) {
s << "#ifndef QT_NO_SSL" << endl;
s << "#ifndef QT_NO_SSL" << Qt::endl;
}
AbstractMetaFunctionList ctors = cls->queryFunctions(AbstractMetaClass::Constructors
| AbstractMetaClass::WasVisible
Expand Down Expand Up @@ -358,28 +358,28 @@ void SetupGenerator::generate()
operatorCodes = "0";
}
if (cls->isQObject()) {
s << "PythonQt::priv()->registerClass(&" << cls->qualifiedCppName() << "::staticMetaObject, \"" << packageName <<"\", PythonQtCreateObject<PythonQtWrapper_" << cls->name() << ">" << shellCreator << ", module, " << operatorCodes <<");" << endl;
s << "PythonQt::priv()->registerClass(&" << cls->qualifiedCppName() << "::staticMetaObject, \"" << packageName <<"\", PythonQtCreateObject<PythonQtWrapper_" << cls->name() << ">" << shellCreator << ", module, " << operatorCodes <<");" << Qt::endl;
} else if (cls->isGlobalNamespace()) {
s << "PythonQt::priv()->registerGlobalNamespace(\"" << cls->qualifiedCppName() << "\", \"" << packageName << "\", PythonQtCreateObject<PythonQtWrapper_" << cls->name() << ">, PythonQtWrapper_" << cls->name() << "::staticMetaObject, module); " << endl;
s << "PythonQt::priv()->registerGlobalNamespace(\"" << cls->qualifiedCppName() << "\", \"" << packageName << "\", PythonQtCreateObject<PythonQtWrapper_" << cls->name() << ">, PythonQtWrapper_" << cls->name() << "::staticMetaObject, module); " << Qt::endl;
} else {
QString baseName = cls->baseClass()?cls->baseClass()->qualifiedCppName():"";
s << "PythonQt::priv()->registerCPPClass(\""<< cls->qualifiedCppName() << "\", \"" << baseName << "\", \"" << packageName <<"\", PythonQtCreateObject<PythonQtWrapper_" << cls->name() << ">" << shellCreator << ", module, " << operatorCodes <<");" << endl;
s << "PythonQt::priv()->registerCPPClass(\""<< cls->qualifiedCppName() << "\", \"" << baseName << "\", \"" << packageName <<"\", PythonQtCreateObject<PythonQtWrapper_" << cls->name() << ">" << shellCreator << ", module, " << operatorCodes <<");" << Qt::endl;
}
for (AbstractMetaClass* interface : cls->interfaces()) {
// the interface might be our own class... (e.g. QPaintDevice)
if (interface->qualifiedCppName() != cls->qualifiedCppName()) {
s << "PythonQt::self()->addParentClass(\""<< cls->qualifiedCppName() << "\", \"" << interface->qualifiedCppName() << "\",PythonQtUpcastingOffset<" << cls->qualifiedCppName() <<","<<interface->qualifiedCppName()<<">());" << endl;
s << "PythonQt::self()->addParentClass(\""<< cls->qualifiedCppName() << "\", \"" << interface->qualifiedCppName() << "\",PythonQtUpcastingOffset<" << cls->qualifiedCppName() <<","<<interface->qualifiedCppName()<<">());" << Qt::endl;
}
}
if (cls->qualifiedCppName().contains("Ssl")) {
s << "#endif" << endl;
s << "#endif" << Qt::endl;
}
}
s << endl;
s << Qt::endl;
for (QString handler : polymorphicHandlers) {
s << "PythonQt::self()->addPolymorphicHandler(\""<< handler << "\", polymorphichandler_" << handler << ");" << endl;
s << "PythonQt::self()->addPolymorphicHandler(\""<< handler << "\", polymorphichandler_" << handler << ");" << Qt::endl;
}
s << endl;
s << Qt::endl;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QStringList list = listRegistration.toList();
Expand All @@ -389,16 +389,16 @@ void SetupGenerator::generate()
list.sort();
for(auto &&name: list) {
if (name.contains("Ssl")) {
s << "#ifndef QT_NO_SSL" << endl;
s << "#ifndef QT_NO_SSL" << Qt::endl;
}
s << name << endl;
s << name << Qt::endl;
if (name.contains("Ssl")) {
s << "#endif" << endl;
s << "#endif" << Qt::endl;
}
}

s << "}";
s << endl;
s << Qt::endl;
}
}
}
Expand Down Expand Up @@ -440,21 +440,21 @@ QStringList SetupGenerator::writePolymorphicHandler(QTextStream &s, const QStrin
handlers.append(handler);

s << "static void* polymorphichandler_" << handler
<< "(const void *ptr, const char **class_name)" << endl
<< "{" << endl
<< " Q_ASSERT(ptr != nullptr);" << endl
<< "(const void *ptr, const char **class_name)" << Qt::endl
<< "{" << Qt::endl
<< " Q_ASSERT(ptr != nullptr);" << Qt::endl
<< " " << cls->qualifiedCppName() << " *object = ("
<< cls->qualifiedCppName() << " *)ptr;" << endl;
<< cls->qualifiedCppName() << " *)ptr;" << Qt::endl;
}

// For each, add case label
QString polyId = clazz->typeEntry()->polymorphicIdValue();
s << " if ("
<< polyId.replace("%1", "object")
<< ") {" << endl
<< " *class_name = \"" << clazz->name() << "\";" << endl
<< " return (" << clazz->qualifiedCppName() << "*)object;" << endl
<< " }" << endl;
<< ") {" << Qt::endl
<< " *class_name = \"" << clazz->name() << "\";" << Qt::endl
<< " return (" << clazz->qualifiedCppName() << "*)object;" << Qt::endl
<< " }" << Qt::endl;
} else {
QString warning = QString("class '%1' inherits from polymorphic class '%2', but has no polymorphic id set")
.arg(clazz->name())
Expand All @@ -467,8 +467,8 @@ QStringList SetupGenerator::writePolymorphicHandler(QTextStream &s, const QStrin

// Close the function if it has been opened
if (!first) {
s << " return nullptr;" << endl
<< "}" << endl;
s << " return nullptr;" << Qt::endl
<< "}" << Qt::endl;
}
}

Expand Down
2 changes: 1 addition & 1 deletion generator/shellgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ void ShellGenerator::writeInclude(QTextStream &stream, const Include &inc)
stream << ">";
else
stream << "\"";
stream << endl;
stream << Qt::endl;
}

const AbstractMetaClass* ShellGenerator::setCurrentScope(const AbstractMetaClass* scope)
Expand Down
Loading