static QTextStream &ensureEndl(QTextStream &s)
{
if (lastChar(s) != QLatin1Char('\n'))
- s << Qt::endl;
+ s << endl;
return s;
}
if (!m_inlineImages.isEmpty()) {
// Write out inline image definitions stored in handleInlineImageTag().
- m_output << Qt::endl;
+ m_output << endl;
for (const InlineImage &img : qAsConst(m_inlineImages))
- m_output << ".. |" << img.tag << "| image:: " << img.href << Qt::endl;
- m_output << Qt::endl;
+ m_output << ".. |" << img.tag << "| image:: " << img.href << endl;
+ m_output << endl;
m_inlineImages.clear();
}
else
type = types[typeIdx];
} else if (token == QXmlStreamReader::EndElement) {
- m_output << Pad(type, headingSize) << Qt::endl << Qt::endl;
+ m_output << Pad(type, headingSize) << endl << endl;
} else if (token == QXmlStreamReader::Characters) {
- m_output << Qt::endl << Qt::endl;
+ m_output << endl << endl;
headingSize = writeEscapedRstText(m_output, reader.text().trimmed());
- m_output << Qt::endl;
+ m_output << endl;
}
}
else if (result.startsWith(QLatin1String("**Note:**")))
result.replace(0, 9, QLatin1String(".. note:: "));
- m_output << INDENT << result << Qt::endl << Qt::endl;
+ m_output << INDENT << result << endl << endl;
} else if (token == QXmlStreamReader::Characters) {
const QStringRef text = reader.text();
const QChar end = lastChar(m_output);
handleLinkEnd(m_seeAlsoContext.data());
m_seeAlsoContext.reset();
}
- m_output << Qt::endl << Qt::endl;
+ m_output << endl << endl;
break;
default:
break;
for (const QStringRef &line : lines) {
if (!line.trimmed().isEmpty())
str << indent << line;
- str << Qt::endl;
+ str << endl;
}
}
m_output << INDENT << "<Code snippet \"" << location << ':' << identifier << "\" not found>\n";
else
formatSnippet(m_output, INDENT, code);
- m_output << Qt::endl;
+ m_output << endl;
}
}
void QtXmlToSphinx::handleDotsTag(QXmlStreamReader& reader)
switch (listType) {
case BulletList:
case OrderedList: {
- m_output << Qt::endl;
+ m_output << endl;
const char *separator = listType == BulletList ? "* " : "#. ";
const char *indent = listType == BulletList ? " " : " ";
for (const TableCell &cell : m_currentTable.constFirst()) {
const QVector<QStringRef> itemLines = cell.data.splitRef(QLatin1Char('\n'));
- m_output << INDENT << separator << itemLines.constFirst() << Qt::endl;
+ m_output << INDENT << separator << itemLines.constFirst() << endl;
for (int i = 1, max = itemLines.count(); i < max; ++i)
- m_output << INDENT << indent << itemLines[i] << Qt::endl;
+ m_output << INDENT << indent << itemLines[i] << endl;
}
- m_output << Qt::endl;
+ m_output << endl;
}
break;
case EnumeratedList:
return;
const QString href = reader.attributes().value(QLatin1String("href")).toString();
if (copyImage(href))
- m_output << INDENT << ".. image:: " << href << Qt::endl << Qt::endl;
+ m_output << INDENT << ".. image:: " << href << endl << endl;
}
void QtXmlToSphinx::handleInlineImageTag(QXmlStreamReader& reader)
QXmlStreamReader::TokenType token = reader.tokenType();
if (token == QXmlStreamReader::StartElement) {
QString format = reader.attributes().value(QLatin1String("format")).toString();
- m_output << INDENT << ".. raw:: " << format.toLower() << Qt::endl << Qt::endl;
+ m_output << INDENT << ".. raw:: " << format.toLower() << endl << endl;
} else if (token == QXmlStreamReader::Characters) {
const QVector<QStringRef> lst(reader.text().split(QLatin1Char('\n')));
for (const QStringRef &row : lst)
- m_output << INDENT << INDENT << row << Qt::endl;
+ m_output << INDENT << INDENT << row << endl;
} else if (token == QXmlStreamReader::EndElement) {
- m_output << Qt::endl << Qt::endl;
+ m_output << endl << endl;
}
}
} else if (token == QXmlStreamReader::Characters) {
const QVector<QStringRef> lst(reader.text().split(QLatin1Char('\n')));
for (const QStringRef &row : lst)
- m_output << INDENT << INDENT << row << Qt::endl;
+ m_output << INDENT << INDENT << row << endl;
} else if (token == QXmlStreamReader::EndElement) {
- m_output << Qt::endl << Qt::endl;
+ m_output << endl << endl;
INDENT.indent--;
}
}
? writeEscapedRstText(m_output, title)
: writeEscapedRstText(m_output, fullTitle);
- m_output << Qt::endl << Pad('*', size) << Qt::endl << Qt::endl;
+ m_output << endl << Pad('*', size) << endl << endl;
}
void QtXmlToSphinx::handleTargetTag(QXmlStreamReader &reader)
m_output << INDENT << "<Code snippet \"" << location << "\" not found>\n";
else
formatCode(m_output, code, INDENT);
- m_output << Qt::endl;
+ m_output << endl;
}
}
c = '-';
s << Pad(c, colWidths.at(col)) << '+';
}
- s << Qt::endl;
+ s << endl;
// Print the table cells
else
s << ' ';
if (rowLine < rowLines.count())
- s << qSetFieldWidth(colWidths[j]) << Qt::left << rowLines.at(rowLine) << qSetFieldWidth(0);
+ s << qSetFieldWidth(colWidths[j]) << left << rowLines.at(rowLine) << qSetFieldWidth(0);
else
s << Pad(' ', colWidths.at(j));
}
s << "|\n";
}
}
- s << INDENT << horizontalLine << Qt::endl << Qt::endl;
+ s << INDENT << horizontalLine << endl << endl;
}
static QString getFuncName(const AbstractMetaFunction* cppFunc) {
s << INDENT
<< (typesystemIndentation > 0 && typesystemIndentation < line.size()
? line.right(line.size() - typesystemIndentation) : line)
- << Qt::endl;
+ << endl;
}
}
- s << Qt::endl;
+ s << endl;
}
static void writeInheritedByList(QTextStream& s, const AbstractMetaClass* metaClass, const AbstractMetaClassList& allClasses)
QStringList classes;
for (AbstractMetaClass *c : qAsConst(res))
classes << QLatin1String(":ref:`") + getClassTargetFullName(c, false) + QLatin1Char('`');
- s << classes.join(QLatin1String(", ")) << Qt::endl << Qt::endl;
+ s << classes.join(QLatin1String(", ")) << endl << endl;
}
// Extract the <brief> section from a WebXML (class) documentation and remove it
s << ".. _" << className << ":" << "\n\n";
s << ".. currentmodule:: " << metaClass->package() << "\n\n\n";
- s << className << Qt::endl;
- s << Pad('*', className.count()) << Qt::endl << Qt::endl;
+ s << className << endl;
+ s << Pad('*', className.count()) << endl << endl;
auto documentation = metaClass->documentation();
Documentation brief;
if (extractBrief(&documentation, &brief))
writeFormattedText(s, brief, metaClass);
- s << ".. inheritance-diagram:: " << getClassTargetFullName(metaClass, true) << Qt::endl
+ s << ".. inheritance-diagram:: " << getClassTargetFullName(metaClass, true) << endl
<< " :parts: 2\n\n"; // TODO: This would be a parameter in the future...
void QtDocGenerator::writeFunctionBlock(QTextStream& s, const QString& title, QStringList& functions)
{
if (!functions.isEmpty()) {
- s << title << Qt::endl
- << QString(title.size(), QLatin1Char('^')) << Qt::endl;
+ s << title << endl
+ << QString(title.size(), QLatin1Char('^')) << endl;
std::sort(functions.begin(), functions.end());
s << ".. container:: function_list\n\n";
Indentation indentation(INDENT);
for (const QString &func : qAsConst(functions))
- s << INDENT << '*' << ' ' << func << Qt::endl;
+ s << INDENT << '*' << ' ' << func << endl;
- s << Qt::endl << Qt::endl;
+ s << endl << endl;
}
}
const AbstractMetaEnumList &enums = cppClass->enums();
for (AbstractMetaEnum *en : enums) {
- s << section_title << getClassTargetFullName(cppClass) << '.' << en->name() << Qt::endl << Qt::endl;
+ s << section_title << getClassTargetFullName(cppClass) << '.' << en->name() << endl << endl;
writeFormattedText(s, en->documentation(), cppClass);
const auto version = versionOf(en->typeEntry());
if (!version.isNull())
const AbstractMetaFieldList &fields = cppClass->fields();
for (AbstractMetaField *field : fields) {
- s << section_title << getClassTargetFullName(cppClass) << "." << field->name() << Qt::endl << Qt::endl;
+ s << section_title << getClassTargetFullName(cppClass) << "." << field->name() << endl << endl;
//TODO: request for member ‘documentation’ is ambiguous
writeFormattedText(s, field->AbstractMetaAttributes::documentation(), cppClass);
}
}
}
- s << Qt::endl;
+ s << endl;
for (QHash<QString, AbstractMetaArgument*>::const_iterator it = arg_map.cbegin(), end = arg_map.cend(); it != end; ++it) {
Indentation indentation(INDENT, 2);
writeParameterType(s, cppClass, it.value());
}
- s << Qt::endl;
+ s << endl;
for (AbstractMetaFunction *func : qAsConst(lst))
writeFormattedText(s, func->documentation(), cppClass);
if (row.trimmed().size() == 0) {
if (currentRow == 0)
continue;
- s << Qt::endl;
+ s << endl;
}
if (currentRow == 0) {
break;
}
}
- s << row.midRef(offset) << Qt::endl;
+ s << row.midRef(offset) << endl;
currentRow++;
}
}
}
- s << Qt::endl;
+ s << endl;
// TODO: Deprecate the use of doc string on glue code.
// This is pre "add-function" and "inject-documentation" tags.
void QtDocGenerator::writeParameterType(QTextStream& s, const AbstractMetaClass* cppClass, const AbstractMetaArgument* arg)
{
s << INDENT << ":param " << arg->name() << ": "
- << translateToPythonType(arg->type(), cppClass) << Qt::endl;
+ << translateToPythonType(arg->type(), cppClass) << endl;
}
void QtDocGenerator::writeFunctionParametersType(QTextStream &s, const AbstractMetaClass *cppClass,
const AbstractMetaFunction *func)
{
- s << Qt::endl;
+ s << endl;
const AbstractMetaArgumentList &funcArgs = func->arguments();
for (AbstractMetaArgument *arg : funcArgs) {
if (retType.isEmpty())
retType = translateToPythonType(func->type(), cppClass);
- s << INDENT << ":rtype: " << retType << Qt::endl;
+ s << INDENT << ":rtype: " << retType << endl;
}
- s << Qt::endl;
+ s << endl;
}
void QtDocGenerator::writeFunction(QTextStream& s, const AbstractMetaClass* cppClass,
std::sort(it.value().begin(), it.value().end());
if (i)
- ss << Qt::endl;
+ ss << endl;
ss << "**" << it.key() << "**\n\n";
i += 2; // a letter title is equivalent to two entries in space
FileOut output(outputDir + QLatin1String("/index.rst"));
QTextStream& s = output.stream;
- s << ".. module:: " << it.key() << Qt::endl << Qt::endl;
+ s << ".. module:: " << it.key() << endl << endl;
const QString &title = it.key();
- s << title << Qt::endl;
- s << Pad('*', title.length()) << Qt::endl << Qt::endl;
+ s << title << endl;
+ s << Pad('*', title.length()) << endl << endl;
/* Avoid showing "Detailed Description for *every* class in toc tree */
Indentation indentation(INDENT);
Indentation deeperIndentation(INDENT);
s << INDENT << ":maxdepth: 1\n\n";
for (const QString &className : qAsConst(it.value()))
- s << INDENT << className << Qt::endl;
- s << Qt::endl << Qt::endl;
+ s << INDENT << className << endl;
+ s << endl << endl;
}
s << "Detailed Description\n--------------------\n\n";
const AbstractMetaClass *metaClass = classContext.metaClass();
// write license comment
- s << licenseComment() << Qt::endl;
+ s << licenseComment() << endl;
if (!avoidProtectedHack() && !metaClass->isNamespace() && !metaClass->hasPrivateDestructor()) {
s << "//workaround to access protected functions\n";
headerfile.replace(QLatin1String(".cpp"), QLatin1String(".h"));
s << "\n// main header\n" << "#include \"" << headerfile << "\"\n";
- s << Qt::endl << "// inner classes\n";
+ s << endl << "// inner classes\n";
const AbstractMetaClassList &innerClasses = metaClass->innerClasses();
for (AbstractMetaClass *innerClass : innerClasses) {
GeneratorContext innerClassContext = contextForClass(innerClass);
includes.append(cppEnum->typeEntry()->extraIncludes());
std::sort(includes.begin(), includes.end());
for (const Include &inc : qAsConst(includes))
- s << inc.toString() << Qt::endl;
- s << Qt::endl;
+ s << inc.toString() << endl;
+ s << endl;
s << "\n#include <cctype>\n#include <cstring>\n";
}
}
- s << Qt::endl << Qt::endl << typeNameFunc << Qt::endl;
+ s << endl << endl << typeNameFunc << endl;
// Create string literal for smart pointer getter method.
if (classContext.forSmartPointer()) {
writeClassCodeSnips(s, metaClass->typeEntry()->codeSnips(),
TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode,
classContext);
- s << Qt::endl;
+ s << endl;
}
// python conversion rules
if (metaClass->typeEntry()->hasTargetConversionRule()) {
s << "// Python Conversion\n";
- s << metaClass->typeEntry()->conversionRule() << Qt::endl;
+ s << metaClass->typeEntry()->conversionRule() << endl;
}
if (classContext.useWrapper()) {
// Write methods definition
s << "static PyMethodDef " << className << "_methods[] = {\n";
- s << methodsDefinitions << Qt::endl;
+ s << methodsDefinitions << endl;
if (metaClass->typeEntry()->isValue() || metaClass->typeEntry()->isSmartPointer()) {
s << INDENT << "{\"__copy__\", reinterpret_cast<PyCFunction>(" << className << "___copy__)"
<< ", METH_NOARGS},\n";
writeCppSelfDefinition(s, classContext);
if (f->allowThread()) {
s << INDENT << "int result;\n";
- s << INDENT << BEGIN_ALLOW_THREADS << Qt::endl;
+ s << INDENT << BEGIN_ALLOW_THREADS << endl;
s << INDENT << "result = !" << CPP_SELF_VAR << "->isNull();\n";
- s << INDENT << END_ALLOW_THREADS << Qt::endl;
+ s << INDENT << END_ALLOW_THREADS << endl;
s << INDENT << "return result;\n";
} else {
s << INDENT << "return !" << CPP_SELF_VAR << "->isNull();\n";
writeGetterFunction(s, metaField, classContext);
if (canGenerateFieldSetter(metaField))
writeSetterFunction(s, metaField, classContext);
- s << Qt::endl;
+ s << endl;
}
- s << "// Getters and Setters for " << metaClass->name() << Qt::endl;
+ s << "// Getters and Setters for " << metaClass->name() << endl;
s << "static PyGetSetDef " << cpythonGettersSettersDefinitionName(metaClass) << "[] = {\n";
for (const AbstractMetaField *metaField : fields) {
if (metaField->isStatic())
writeTpClearFunction(s, metaClass);
writeClassDefinition(s, metaClass, classContext);
- s << Qt::endl;
+ s << endl;
if (metaClass->isPolymorphic() && metaClass->baseClass())
writeTypeDiscoveryFunction(s, metaClass);
if (hasFlags) {
writeFlagsMethods(s, cppEnum);
writeFlagsNumberMethodsDefinition(s, cppEnum);
- s << Qt::endl;
+ s << endl;
}
}
- s << Qt::endl;
+ s << endl;
writeConverterFunctions(s, metaClass, classContext);
writeClassRegister(s, metaClass, classContext, signatureStream);
writeClassCodeSnips(s, metaClass->typeEntry()->codeSnips(),
TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode,
classContext);
- s << Qt::endl;
+ s << endl;
}
}
errorMsg += func->signature();
errorMsg = msgCouldNotFindMinimalConstructor(errorMsg, func->type()->cppSignature());
qCWarning(lcShiboken).noquote().nospace() << errorMsg;
- s << Qt::endl << INDENT << "#error " << errorMsg << Qt::endl;
+ s << endl << INDENT << "#error " << errorMsg << endl;
}
} else {
defaultReturnExpr.setType(DefaultValue::Void);
<< QString::fromLatin1("Pure virtual method '%1::%2' must be implement but was "\
"completely removed on type system.")
.arg(func->ownerClass()->name(), func->minimalSignature());
- s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << Qt::endl;
+ s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << endl;
s << "}\n\n";
return;
}
CodeSnipList snips = func->injectedCodeSnips();
const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionDeclaration, TypeSystem::NativeCode, func, lastArg);
- s << Qt::endl;
+ s << endl;
}
// PYSIDE-803: Build a boolean cache for unused overrides.
s << INDENT << "if (PyErr_Occurred())\n";
{
Indentation indentation(INDENT);
- s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << Qt::endl;
+ s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << endl;
}
s << INDENT << "Shiboken::AutoDecRef " << PYTHON_OVERRIDE_VAR << "(Shiboken::BindingManager::instance().getOverride(this, \"";
snips = func->injectedCodeSnips();
const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::ShellCode, func, lastArg);
- s << Qt::endl;
+ s << endl;
}
if (func->isAbstract()) {
}
s << "Py_BuildValue(\"(" << getFormatUnitString(func, false) << ")\",\n";
- s << argConversions.join(QLatin1String(",\n")) << Qt::endl;
+ s << argConversions.join(QLatin1String(",\n")) << endl;
s << INDENT << "));\n";
}
}
}
}
- s << Qt::endl;
+ s << endl;
CodeSnipList snips;
if (func->hasInjectedCode()) {
const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode, func, lastArg);
- s << Qt::endl;
+ s << endl;
}
if (!injectedCodeCallsPythonOverride(func)) {
{
Indentation indent(INDENT);
s << INDENT << "PyErr_Print();\n";
- s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << Qt::endl;
+ s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << endl;
}
s << INDENT << "}\n";
"\"Invalid return value in function %s, expected %s, got %s.\", \"";
s << func->ownerClass()->name() << '.' << funcName << "\", " << getVirtualFunctionReturnTypeName(func);
s << ", Py_TYPE(" << PYTHON_RETURN_VAR << ")->tp_name);\n";
- s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << Qt::endl;
+ s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << endl;
}
s << INDENT << "}\n";
"\"Invalid return value in function %s, expected %s, got %s.\", \"";
s << func->ownerClass()->name() << '.' << funcName << "\", " << getVirtualFunctionReturnTypeName(func);
s << ", Py_TYPE(" << PYTHON_RETURN_VAR << ")->tp_name);\n";
- s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << Qt::endl;
+ s << INDENT << returnStatement(defaultReturnExpr.returnValue()) << endl;
}
s << INDENT << "}\n";
}
if (func->hasInjectedCode()) {
- s << Qt::endl;
+ s << endl;
const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode, func, lastArg);
}
}
c << ";\n";
writeCppToPythonFunction(s, code, typeName, typeName);
- s << Qt::endl;
+ s << endl;
if (enumType->isFlags())
return;
const QString pyTypeCheck = QLatin1String("PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(")
+ cpythonType + QLatin1String("))");
writeIsPythonConvertibleToCppFunction(s, sourceTypeName, targetTypeName, pyTypeCheck, QString(), true);
- s << Qt::endl;
+ s << endl;
// C++ pointer to a Python wrapper, keeping identity.
s << "// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).\n";
// The conversions for an Object Type end here.
if (!metaClass->typeEntry()->isValue() && !metaClass->typeEntry()->isSmartPointer()) {
- s << Qt::endl;
+ s << endl;
return;
}
// Always copies C++ value (not pointer, and not reference) to a new Python wrapper.
- s << Qt::endl << "// C++ to Python copy conversion.\n";
+ s << endl << "// C++ to Python copy conversion.\n";
if (!classContext.forSmartPointer())
targetTypeName = metaClass->name();
else
<< ", new ::" << computedWrapperName << "(*reinterpret_cast<const "
<< typeName << " *>(cppIn)), true, true);";
writeCppToPythonFunction(s, code, sourceTypeName, targetTypeName);
- s << Qt::endl;
+ s << endl;
// Python to C++ copy conversion.
s << "// Python to C++ copy conversion.\n";
// "Is convertible" function for the Python object to C++ value copy conversion.
writeIsPythonConvertibleToCppFunction(s, sourceTypeName, targetTypeName, pyTypeCheck);
- s << Qt::endl;
+ s << endl;
// User provided implicit conversions.
CustomConversion *customConversion = metaClass->typeEntry()->customConversion();
s << "// Python to C++ conversions for type '" << customConversion->ownerType()->qualifiedCppName() << "'.\n";
for (CustomConversion::TargetToNativeConversion *toNative : toCppConversions)
writePythonToCppConversionFunctions(s, toNative, customConversion->ownerType());
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeConverterRegister(QTextStream &s, const AbstractMetaClass *metaClass,
return;
s << INDENT << "// Register Converter\n";
s << INDENT << "SbkConverter *converter = Shiboken::Conversions::createConverter(";
- s << cpythonTypeName(metaClass) << ',' << Qt::endl;
+ s << cpythonTypeName(metaClass) << ',' << endl;
{
Indentation indent(INDENT);
QString sourceTypeName = metaClass->name();
QString targetTypeName = sourceTypeName + QLatin1String("_PTR");
- s << INDENT << pythonToCppFunctionName(sourceTypeName, targetTypeName) << ',' << Qt::endl;
- s << INDENT << convertibleToCppFunctionName(sourceTypeName, targetTypeName) << ',' << Qt::endl;
+ s << INDENT << pythonToCppFunctionName(sourceTypeName, targetTypeName) << ',' << endl;
+ s << INDENT << convertibleToCppFunctionName(sourceTypeName, targetTypeName) << ',' << endl;
std::swap(targetTypeName, sourceTypeName);
s << INDENT << cppToPythonFunctionName(sourceTypeName, targetTypeName);
if (metaClass->typeEntry()->isValue() || metaClass->typeEntry()->isSmartPointer()) {
- s << ',' << Qt::endl;
+ s << ',' << endl;
sourceTypeName = metaClass->name() + QLatin1String("_COPY");
s << INDENT << cppToPythonFunctionName(sourceTypeName, targetTypeName);
}
}
s << ");\n";
- s << Qt::endl;
+ s << endl;
QStringList cppSignature;
if (!classContext.forSmartPointer()) {
cppSignature = metaClass->qualifiedCppName().split(QLatin1String("::"),
- Qt::SkipEmptyParts);
+ QString::SkipEmptyParts);
} else {
cppSignature = classContext.preciseType()->cppSignature().split(QLatin1String("::"),
- Qt::SkipEmptyParts);
+ QString::SkipEmptyParts);
}
while (!cppSignature.isEmpty()) {
QString signature = cppSignature.join(QLatin1String("::"));
s << classContext.wrapperName() << ").name());\n";
}
- s << Qt::endl;
+ s << endl;
if (!metaClass->typeEntry()->isValue() && !metaClass->typeEntry()->isSmartPointer())
return;
s << qualifiedCppName << " >()))\n";
Indentation indent(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl << endl;
}
// Declare pointer for the underlying C++ object.
s << INDENT << "::";
s << INDENT << "\"'" << metaClass->qualifiedCppName();
}
s << "' represents a C++ abstract class and cannot be instantiated\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT<< "}\n\n";
}
writeMethodWrapperPreamble(s, overloadData, classContext);
- s << Qt::endl;
+ s << endl;
if (overloadData.maxArgs() > 0)
writeOverloadedFunctionDecisor(s, overloadData);
writeFunctionCalls(s, overloadData, classContext);
- s << Qt::endl;
+ s << endl;
s << INDENT << "if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::" << metaClass->qualifiedCppName() << " >(), cptr)) {\n";
{
Indentation indent(INDENT);
s << INDENT << "delete cptr;\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << "}\n";
if (overloadData.maxArgs() > 0) {
s << INDENT << "if (!cptr) goto " << cpythonFunctionName(rfunc) << "_TypeError;\n";
- s << Qt::endl;
+ s << endl;
}
s << INDENT << "Shiboken::Object::setValidCpp(sbkSelf, true);\n";
// Create metaObject and register signal/slot
if (metaClass->isQObject() && usePySideExtensions()) {
- s << Qt::endl << INDENT << "// QObject setup\n";
+ s << endl << INDENT << "// QObject setup\n";
s << INDENT << "PySide::Signal::updateSourceObject(self);\n";
s << INDENT << "metaObject = cptr->metaObject(); // <- init python qt properties\n";
s << INDENT << "if (kwds && !PySide::fillQtProperties(self, metaObject, kwds, argNames, " << argNamesSet.count() << "))\n";
{
Indentation indentation(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
}
const CodeSnipList &injectedCodeSnips = func->injectedCodeSnips();
for (const CodeSnip &cs : injectedCodeSnips) {
if (cs.position == TypeSystem::CodeSnipPositionEnd) {
- s << INDENT << "case " << metaClass->functions().indexOf(func) << ':' << Qt::endl;
+ s << INDENT << "case " << metaClass->functions().indexOf(func) << ':' << endl;
s << INDENT << "{\n";
{
Indentation indent(INDENT);
s << "}\n";
}
- s << Qt::endl;
- s << Qt::endl << INDENT << "return 1;\n";
+ s << endl;
+ s << endl << INDENT << "return 1;\n";
if (overloadData.maxArgs() > 0)
writeErrorSection(s, overloadData);
s<< "}\n\n";
writeMethodWrapperPreamble(s, overloadData, classContext);
- s << Qt::endl;
+ s << endl;
/*
* This code is intended for shift operations only:
writeFunctionCalls(s, overloadData, classContext);
if (callExtendedReverseOperator)
- s << Qt::endl << INDENT << "} // End of \"if (!" << PYTHON_RETURN_VAR << ")\"\n";
+ s << endl << INDENT << "} // End of \"if (!" << PYTHON_RETURN_VAR << ")\"\n";
- s << Qt::endl;
+ s << endl;
writeFunctionReturnErrorCheckSection(s, hasReturnValue && !rfunc->isInplaceOperator());
s << INDENT << "PyObject *";
s << PYTHON_ARGS << "[] = {"
- << QString(maxArgs, QLatin1Char('0')).split(QLatin1String(""), Qt::SkipEmptyParts).join(QLatin1String(", "))
+ << QString(maxArgs, QLatin1Char('0')).split(QLatin1String(""), QString::SkipEmptyParts).join(QLatin1String(", "))
<< "};\n";
- s << Qt::endl;
+ s << endl;
if (overloadData.hasVarargs()) {
maxArgs--;
s << INDENT << "Shiboken::AutoDecRef auto_nonvarargs(nonvarargs);\n";
s << INDENT << PYTHON_ARGS << '[' << maxArgs << "] = PyTuple_GetSlice(args, " << maxArgs << ", numArgs);\n";
s << INDENT << "Shiboken::AutoDecRef auto_varargs(" << PYTHON_ARGS << "[" << maxArgs << "]);\n";
- s << Qt::endl;
+ s << endl;
}
bool usesNamedArguments = overloadData.hasArgumentWithDefaultValue();
{
Indentation indent(INDENT);
s << INDENT << "PyErr_SetString(PyExc_TypeError, \"" << fullPythonFunctionName(rfunc) << "(): too many arguments\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << '}';
}
{
Indentation indent(INDENT);
s << INDENT << "PyErr_SetString(PyExc_TypeError, \"" << fullPythonFunctionName(rfunc) << "(): not enough arguments\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << '}';
}
Indentation indent(INDENT);
s << INDENT << "goto " << cpythonFunctionName(rfunc) << "_TypeError;";
}
- s << Qt::endl << Qt::endl;
+ s << endl << endl;
QString funcName;
if (rfunc->isOperatorOverload())
s << "))\n";
{
Indentation indent(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeCppSelfConversion(QTextStream &s, const GeneratorContext &context,
void CppGenerator::writeErrorSection(QTextStream &s, OverloadData &overloadData)
{
const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
- s << Qt::endl << INDENT << cpythonFunctionName(rfunc) << "_TypeError:\n";
+ s << endl << INDENT << cpythonFunctionName(rfunc) << "_TypeError:\n";
Indentation indentation(INDENT);
QString funcName = fullPythonFunctionName(rfunc);
Indentation indent(INDENT);
if (hasReturnValue)
s << INDENT << "Py_XDECREF(" << PYTHON_RETURN_VAR << ");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << "}\n";
}
{
s << INDENT << "if (!Shiboken::Object::isValid(" << pyObj << "))\n";
Indentation indent(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
static QString pythonToCppConverterForArgumentName(const QString &argumentName)
if (!defaultValue.isEmpty())
s << INDENT << '}';
- s << Qt::endl;
+ s << endl;
}
static void addConversionRuleCodeSnippet(CodeSnipList &snippetList, QString &rule,
s << "static ";
if (const auto *decl = func->declaringClass())
s << decl->name() << "::";
- s << func->minimalSignature() << Qt::endl;
+ s << func->minimalSignature() << endl;
}
writeOverloadedFunctionDecisorEngine(s, &overloadData);
- s << Qt::endl;
+ s << endl;
// Ensure that the direct overload that called this reverse
// is called.
s << INDENT << "// Function signature not found.\n";
s << INDENT << "if (overloadId == -1) goto " << cpythonFunctionName(overloadData.referenceFunction()) << "_TypeError;\n";
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream &s, const OverloadData *parentOverloadData)
// Functions without arguments are identified right away.
if (maxArgs == 0) {
s << INDENT << "overloadId = " << parentOverloadData->headOverloadData()->overloads().indexOf(referenceFunction);
- s << "; // " << referenceFunction->minimalSignature() << Qt::endl;
+ s << "; // " << referenceFunction->minimalSignature() << endl;
return;
}
if (isLastArgument || (signatureFound && !hasDefaultCall)) {
const AbstractMetaFunction *func = parentOverloadData->referenceFunction();
s << INDENT << "overloadId = " << parentOverloadData->headOverloadData()->overloads().indexOf(func);
- s << "; // " << func->minimalSignature() << Qt::endl;
+ s << "; // " << func->minimalSignature() << endl;
return;
}
}
}
}
s << INDENT << "overloadId = " << parentOverloadData->headOverloadData()->overloads().indexOf(func);
- s << "; // " << func->minimalSignature() << Qt::endl;
+ s << "; // " << func->minimalSignature() << endl;
}
s << INDENT << '}';
}
Indentation indent(INDENT);
QString separator;
QTextStream sep(&separator);
- sep << Qt::endl << INDENT << "&& ";
+ sep << endl << INDENT << "&& ";
s << typeChecks.join(separator);
}
s << ") {\n";
}
s << INDENT << "}";
}
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeFunctionCalls(QTextStream &s, const OverloadData &overloadData,
} else {
for (int i = 0; i < overloads.count(); i++) {
const AbstractMetaFunction *func = overloads.at(i);
- s << INDENT << "case " << i << ": // " << func->signature() << Qt::endl;
+ s << INDENT << "case " << i << ": // " << func->signature() << endl;
s << INDENT << "{\n";
{
Indentation indent(INDENT);
s << INDENT << "PyErr_Format(PyExc_TypeError, \"%s is a private method.\", \""
<< func->signature().replace(QLatin1String("::"), QLatin1String("."))
<< "\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
return;
}
writeArgumentConversion(s, argType, argName, pyArgName, func->implementingClass(), defaultValue, func->isUserAdded());
}
- s << Qt::endl;
+ s << endl;
int numRemovedArgs = OverloadData::numberOfRemovedArguments(func);
if (conversion.isEmpty())
conversion = QLatin1Char('*') + cpythonWrapperCPtr(sourceType->typeEntry(), QLatin1String("pyIn"));
if (!preConversion.isEmpty())
- c << INDENT << preConversion << Qt::endl;
+ c << INDENT << preConversion << endl;
const QString fullTypeName = getFullTypeName(targetType->typeEntry());
c << INDENT << "*reinterpret_cast<" << fullTypeName << " *>(cppOut) = "
<< fullTypeName << '(' << conversion << ");";
if (typeCheck.isEmpty())
typeCheck = QString::fromLatin1("PyObject_TypeCheck(pyIn, %1)").arg(sourcePyType);
writeIsPythonConvertibleToCppFunction(s, sourceTypeName, targetTypeName, typeCheck);
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writePythonToCppConversionFunctions(QTextStream &s,
else
typeCheck = QString::fromLatin1("%1pyIn)").arg(typeCheck);
writeIsPythonConvertibleToCppFunction(s, typeName, typeName, typeCheck);
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeAddPythonToCppConversion(QTextStream &s, const QString &converterVar, const QString &pythonToCppFunc, const QString &isConvertibleFunc)
{
- s << INDENT << "Shiboken::Conversions::addPythonToCppValueConversion(" << converterVar << ',' << Qt::endl;
+ s << INDENT << "Shiboken::Conversions::addPythonToCppValueConversion(" << converterVar << ',' << endl;
{
Indentation indent(INDENT);
- s << INDENT << pythonToCppFunc << ',' << Qt::endl;
+ s << INDENT << pythonToCppFunc << ',' << endl;
s << INDENT << isConvertibleFunc;
}
s << ");\n";
s << INDENT << "if (value && " << pyArgName << ") {\n";
{
Indentation indent(INDENT);
- s << INDENT << pyErrString.arg(arg->name()) << Qt::endl;
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << pyErrString.arg(arg->name()) << endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << "}\n";
s << INDENT << "if (value) {\n";
void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *func,
const GeneratorContext &context, int maxArgs)
{
- s << INDENT << "// " << func->minimalSignature() << (func->isReverseOperator() ? " [reverse operator]": "") << Qt::endl;
+ s << INDENT << "// " << func->minimalSignature() << (func->isReverseOperator() ? " [reverse operator]": "") << endl;
if (func->isConstructor()) {
const CodeSnipList &snips = func->injectedCodeSnips();
for (const CodeSnip &cs : snips) {
Indentation indent(INDENT);
s << INDENT << "PyErr_SetString(PyExc_NotImplementedError, \"pure virtual method '";
s << func->ownerClass()->name() << '.' << func->name() << "()' not implemented.\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << "}\n";
}
}
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::TargetLangCode, func, lastArg);
- s << Qt::endl;
+ s << endl;
}
writeConversionRule(s, func, TypeSystem::NativeCode);
std::swap(firstArg, secondArg);
if (((op == QLatin1String("++")) || (op == QLatin1String("--"))) && !func->isReverseOperator()) {
- s << Qt::endl << INDENT << "for (int i=0; i < " << secondArg << "; i++, " << firstArg << op << ");\n";
+ s << endl << INDENT << "for (int i=0; i < " << secondArg << "; i++, " << firstArg << op << ");\n";
mc << firstArg;
} else {
mc << firstArg << ' ' << op << ' ' << secondArg;
<< ctorCall << ";\n"
<< INDENT
<< "PySide::setNextQObjectMemoryAddr(0);"
- << Qt::endl;
+ << endl;
}
uva << INDENT << "} else {\n";
{
<< INDENT << "threadSaver.save();\n";
}
} else if (allowThread) {
- s << INDENT << BEGIN_ALLOW_THREADS << Qt::endl;
+ s << INDENT << BEGIN_ALLOW_THREADS << endl;
}
s << INDENT;
if (isCtor) {
s << (useVAddr.isEmpty() ?
- QString::fromLatin1("cptr = %1;").arg(methodCall) : useVAddr) << Qt::endl;
+ QString::fromLatin1("cptr = %1;").arg(methodCall) : useVAddr) << endl;
} else if (func->type() && !func->isInplaceOperator()) {
bool writeReturnType = true;
if (avoidProtectedHack()) {
}
if (func->hasInjectedCode() && !func->isConstructor()) {
- s << Qt::endl;
+ s << endl;
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionEnd, TypeSystem::TargetLangCode, func, lastArg);
}
hasReturnPolicy = true;
if (!ownership_mods.isEmpty()) {
- s << Qt::endl << INDENT << "// Ownership transferences.\n";
+ s << endl << INDENT << "// Ownership transferences.\n";
for (const ArgumentModification &arg_mod : qAsConst(ownership_mods)) {
const AbstractMetaClass *wrappedClass = nullptr;
QString pyArgName = argumentNameFromIndex(func, arg_mod.index, &wrappedClass);
if (!wrappedClass) {
- s << "#error Invalid ownership modification for argument " << arg_mod.index << '(' << pyArgName << ")\n" << Qt::endl;
+ s << "#error Invalid ownership modification for argument " << arg_mod.index << '(' << pyArgName << ")\n" << endl;
break;
}
} else {
s << "invalidate(" << pyArgName << ");";
}
- s << Qt::endl;
+ s << endl;
}
} else if (!refcount_mods.isEmpty()) {
} else {
pyArgName = argumentNameFromIndex(func, arg_mod.index, &wrappedClass);
if (pyArgName.isEmpty()) {
- s << "#error Invalid reference count modification for argument " << arg_mod.index << Qt::endl << Qt::endl;
+ s << "#error Invalid reference count modification for argument " << arg_mod.index << endl << endl;
break;
}
}
for (const QString &ancestor : ancestors)
s << INDENT << "offsets.insert(int(" << ancestor << "));\n";
- s << Qt::endl;
+ s << endl;
s << INDENT << "offsets.erase(0);\n";
- s << Qt::endl;
+ s << endl;
s << INDENT << "std::copy(offsets.cbegin(), offsets.cend(), mi_offsets);\n";
}
{
Indentation indent(INDENT);
QString typeName = fixedCppTypeName(enumType);
- s << INDENT << "SbkConverter *converter = Shiboken::Conversions::createConverter(" << enumPythonType << ',' << Qt::endl;
+ s << INDENT << "SbkConverter *converter = Shiboken::Conversions::createConverter(" << enumPythonType << ',' << endl;
{
Indentation indent(INDENT);
s << INDENT << cppToPythonFunctionName(typeName, typeName) << ");\n";
void CppGenerator::writeExtendedConverterInitialization(QTextStream &s, const TypeEntry *externalType,
const QVector<const AbstractMetaClass *>& conversions)
{
- s << INDENT << "// Extended implicit conversions for " << externalType->qualifiedTargetLangName() << '.' << Qt::endl;
+ s << INDENT << "// Extended implicit conversions for " << externalType->qualifiedTargetLangName() << '.' << endl;
for (const AbstractMetaClass *sourceClass : conversions) {
const QString converterVar = QLatin1String("reinterpret_cast<SbkObjectType *>(")
+ cppApiVariableName(externalType->targetLangPackage()) + QLatin1Char('[')
if (metaClass == miClass)
writeMultipleInheritanceInitializerFunction(s, metaClass);
writeSpecialCastFunction(s, metaClass);
- s << Qt::endl;
+ s << endl;
}
s << "// Class Definition -----------------------------------------------\n";
s << "{\n";
s << INDENT << "return " << typePtr << ";\n";
s << "}\n";
- s << Qt::endl;
+ s << endl;
s << "static PyType_Slot " << className << "_slots[] = {\n";
s << INDENT << "{Py_tp_base, nullptr}, // inserted by introduceWrapperType\n";
s << INDENT << pyTypeSlotEntry("Py_tp_dealloc", tp_dealloc)
s << INDENT << tp_flags << ",\n";
s << INDENT << className << "_slots\n";
s << "};\n";
- s << Qt::endl;
- s << "} //extern \"C\"" << Qt::endl;
+ s << endl;
+ s << "} //extern \"C\"" << endl;
}
void CppGenerator::writeMappingMethods(QTextStream &s,
writeFunctionReturnErrorCheckSection(s);
s << INDENT << "return " << PYTHON_RETURN_VAR << ";\n";
s << "}\n";
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeGetterFunction(QTextStream &s,
s << cppField << ";\n";
s << INDENT << PYTHON_TO_CPP_VAR << "(pyIn, &cppOut_ptr)";
}
- s << ";\n" << Qt::endl;
+ s << ";\n" << endl;
if (isPointerToWrapperType(fieldType)) {
s << INDENT << "Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(self), \"";
s << INDENT << "PyObject *" << PYTHON_RETURN_VAR << "{};\n";
s << INDENT << "PythonToCppFunc " << PYTHON_TO_CPP_VAR << ";\n";
writeUnusedVariableCast(s, QLatin1String(PYTHON_TO_CPP_VAR));
- s << Qt::endl;
+ s << endl;
s << INDENT << "switch (op) {\n";
{
const AbstractMetaFunction *rfunc = overloads[0];
QString operatorId = ShibokenGenerator::pythonRichCompareOperatorId(rfunc);
- s << INDENT << "case " << operatorId << ':' << Qt::endl;
+ s << INDENT << "case " << operatorId << ':' << endl;
Indentation indent(INDENT);
s << ") {\n";
{
Indentation indent(INDENT);
- s << INDENT << "// " << func->signature() << Qt::endl;
+ s << INDENT << "// " << func->signature() << endl;
writeArgumentConversion(s, argType, QLatin1String(CPP_ARG0),
QLatin1String(PYTHON_ARG), metaClass,
QString(), func->isUserAdded());
}
s << INDENT << baseName << "_RichComparison_TypeError:\n";
s << INDENT << "PyErr_SetString(PyExc_NotImplementedError, \"operator not implemented.\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl << endl;
s<< "}\n\n";
}
writeMethodDefinitionEntry(s, overloads);
s << '}';
}
- s << ',' << Qt::endl;
+ s << ',' << endl;
}
void CppGenerator::writeSignatureInfo(QTextStream &s, const AbstractMetaFunctionList &overloads)
s << funcName << '(' << args.join(QLatin1Char(',')) << ')';
if (f->type())
s << "->" << f->type()->pythonSignature();
- s << Qt::endl;
+ s << endl;
}
}
s << INDENT << enumVarTypeObj << " = Shiboken::Enum::";
s << ((enclosingClass || hasUpperEnclosingClass) ? "createScopedEnum" : "createGlobalEnum");
- s << '(' << enclosingObjectVariable << ',' << Qt::endl;
+ s << '(' << enclosingObjectVariable << ',' << endl;
{
Indentation indent(INDENT);
s << INDENT << '"' << cppEnum->name() << "\",\n";
s << INDENT << '"' << (cppEnum->enclosingClass() ? (cppEnum->enclosingClass()->qualifiedCppName() + QLatin1String("::")) : QString());
s << cppEnum->name() << '"';
if (flags)
- s << ',' << Qt::endl << INDENT << cpythonTypeNameExt(flags);
+ s << ',' << endl << INDENT << cpythonTypeNameExt(flags);
s << ");\n";
}
s << INDENT << "if (!" << cpythonTypeNameExt(cppEnum->typeEntry()) << ")\n";
{
Indentation indent(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl << endl;
}
}
<< "))->tp_dict, \"" << mangleName(enumValue->name()) << "\", anonEnumItem) < 0)\n";
{
Indentation indent(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << "Py_DECREF(anonEnumItem);\n";
}
s << enumValueText << ") < 0)\n";
{
Indentation indent(INDENT);
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
}
break;
case CEnum: {
s << INDENT << "if (!Shiboken::Enum::";
s << ((enclosingClass || hasUpperEnclosingClass) ? "createScopedEnumItem" : "createGlobalEnumItem");
- s << '(' << enumVarTypeObj << ',' << Qt::endl;
+ s << '(' << enumVarTypeObj << ',' << endl;
Indentation indent(INDENT);
s << INDENT << enclosingObjectVariable << ", \"" << mangleName(enumValue->name()) << "\", ";
s << enumValueText << "))\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
break;
case EnumClass: {
s << INDENT << "if (!Shiboken::Enum::createScopedEnumItem("
- << enumVarTypeObj << ',' << Qt::endl;
+ << enumVarTypeObj << ',' << endl;
Indentation indent(INDENT);
s << INDENT << enumVarTypeObj<< ", \"" << mangleName(enumValue->name()) << "\", "
<< enumValueText << "))\n"
- << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ << INDENT << returnStatement(m_currentErrorCode) << endl;
}
break;
}
s << INDENT << "// End of '" << cppEnum->name() << "' enum";
if (cppEnum->typeEntry()->flags())
s << "/flags";
- s << '.' << Qt::endl << Qt::endl;
+ s << '.' << endl << endl;
}
void CppGenerator::writeSignalInitialization(QTextStream &s, const AbstractMetaClass *metaClass)
writeFlagsToLong(s, cppEnum);
writeFlagsNonZero(s, cppEnum);
- s << Qt::endl;
+ s << endl;
}
void CppGenerator::writeFlagsNumberMethodsDefinition(QTextStream &s, const AbstractMetaEnum *cppEnum)
const AbstractMetaClassList baseClasses = getBaseClasses(metaClass);
if (metaClass->baseClassNames().size() > 1) {
s << INDENT << "PyObject *" << pyTypeBasesVariable
- << " = PyTuple_Pack(" << baseClasses.size() << ',' << Qt::endl;
+ << " = PyTuple_Pack(" << baseClasses.size() << ',' << endl;
Indentation indent(INDENT);
for (int i = 0, size = baseClasses.size(); i < size; ++i) {
if (i)
// 8:baseTypes
if (metaClass->baseClassNames().size() > 1)
- s << INDENT << pyTypeBasesVariable << ',' << Qt::endl;
+ s << INDENT << pyTypeBasesVariable << ',' << endl;
else
s << INDENT << "0,\n";
s << INDENT << wrapperFlags.join(" | ");
}
s << INDENT << ");\n";
- s << INDENT << Qt::endl;
+ s << INDENT << endl;
if (!classContext.forSmartPointer())
- s << INDENT << cpythonTypeNameExt(classTypeEntry) << Qt::endl;
+ s << INDENT << cpythonTypeNameExt(classTypeEntry) << endl;
else
- s << INDENT << cpythonTypeNameExt(classContext.preciseType()) << Qt::endl;
+ s << INDENT << cpythonTypeNameExt(classContext.preciseType()) << endl;
s << INDENT << " = reinterpret_cast<PyTypeObject *>(" << pyTypeName << ");\n";
- s << Qt::endl;
+ s << endl;
// Register conversions for the type.
writeConverterRegister(s, metaClass, classContext);
- s << Qt::endl;
+ s << endl;
// class inject-code target/beginning
if (!classTypeEntry->codeSnips().isEmpty()) {
writeClassCodeSnips(s, classTypeEntry->codeSnips(),
TypeSystem::CodeSnipPositionBeginning, TypeSystem::TargetLangCode,
classContext);
- s << Qt::endl;
+ s << endl;
}
// Fill multiple inheritance data, if needed.
writeToPythonConversion(s, field->type(), metaClass, metaClass->qualifiedCppName() + QLatin1String("::") + field->name());
s << ");\n";
}
- s << Qt::endl;
+ s << endl;
// class inject-code target/end
if (!classTypeEntry->codeSnips().isEmpty()) {
- s << Qt::endl;
+ s << endl;
writeClassCodeSnips(s, classTypeEntry->codeSnips(),
TypeSystem::CodeSnipPositionEnd, TypeSystem::TargetLangCode,
classContext);
QTextStream &s = file.stream;
// write license comment
- s << licenseComment() << Qt::endl;
+ s << licenseComment() << endl;
s << "#include <sbkpython.h>\n";
s << "#include <shiboken.h>\n";
s << "#include <qapp_macro.h>\n";
}
- s << "#include \"" << getModuleHeaderFileName() << '"' << Qt::endl << Qt::endl;
+ s << "#include \"" << getModuleHeaderFileName() << '"' << endl << endl;
for (const Include &include : qAsConst(includes))
s << include;
- s << Qt::endl;
+ s << endl;
// Global enums
AbstractMetaEnumList globalEnums = this->globalEnums();
Q_ASSERT(moduleEntry);
//Extra includes
- s << Qt::endl << "// Extra includes\n";
+ s << endl << "// Extra includes\n";
QVector<Include> extraIncludes = moduleEntry->extraIncludes();
for (AbstractMetaEnum *cppEnum : qAsConst(globalEnums))
extraIncludes.append(cppEnum->typeEntry()->extraIncludes());
std::sort(extraIncludes.begin(), extraIncludes.end());
for (const Include &inc : qAsConst(extraIncludes))
s << inc;
- s << Qt::endl;
+ s << endl;
s << "// Current module's type array.\n";
s << "PyTypeObject **" << cppApiVariableName() << " = nullptr;\n";
// module inject-code native/beginning
if (!snips.isEmpty()) {
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode);
- s << Qt::endl;
+ s << endl;
}
// cleanup staticMetaObject attribute
s << "// Global functions ";
s << "------------------------------------------------------------\n";
- s << globalFunctionImpl << Qt::endl;
+ s << globalFunctionImpl << endl;
s << "static PyMethodDef " << moduleName() << "_methods[] = {\n";
s << globalFunctionDecl;
s << "// Classes initialization functions ";
s << "------------------------------------------------------------\n";
- s << classInitDecl << Qt::endl;
+ s << classInitDecl << endl;
if (!globalEnums.isEmpty()) {
QString converterImpl;
if (cppEnum->isAnonymous() || cppEnum->isPrivate())
continue;
writeEnumConverterFunctions(s, cppEnum);
- s << Qt::endl;
+ s << endl;
}
if (!converterImpl.isEmpty()) {
s << "// Enum converters ";
s << "------------------------------------------------------------\n";
s << "namespace Shiboken\n{\n";
- s << converterImpl << Qt::endl;
+ s << converterImpl << endl;
s << "} // namespace Shiboken\n\n";
}
}
s << "PyTypeObject **" << cppApiVariableName(requiredModule) << ";\n";
s << "SbkConverter **" << convertersVariableName(requiredModule) << ";\n";
}
- s << Qt::endl;
+ s << endl;
s << "// Module initialization ";
s << "------------------------------------------------------------\n";
ExtendedConverterData extendedConverters = getExtendedConverters();
if (!extendedConverters.isEmpty()) {
- s << Qt::endl << "// Extended Converters.\n\n";
+ s << endl << "// Extended Converters.\n\n";
for (ExtendedConverterData::const_iterator it = extendedConverters.cbegin(), end = extendedConverters.cend(); it != end; ++it) {
const TypeEntry *externalType = it.key();
- s << "// Extended implicit conversions for " << externalType->qualifiedTargetLangName() << '.' << Qt::endl;
+ s << "// Extended implicit conversions for " << externalType->qualifiedTargetLangName() << '.' << endl;
for (const AbstractMetaClass *sourceClass : it.value()) {
AbstractMetaType *sourceType = buildAbstractMetaTypeFromAbstractMetaClass(sourceClass);
AbstractMetaType *targetType = buildAbstractMetaTypeFromTypeEntry(externalType);
const QVector<const CustomConversion *> &typeConversions = getPrimitiveCustomConversions();
if (!typeConversions.isEmpty()) {
- s << Qt::endl << "// Primitive Type converters.\n\n";
+ s << endl << "// Primitive Type converters.\n\n";
for (const CustomConversion *conversion : typeConversions) {
s << "// C++ to Python conversion for type '" << conversion->ownerType()->qualifiedCppName() << "'.\n";
writeCppToPythonFunction(s, conversion);
writeCustomConverterFunctions(s, conversion);
}
- s << Qt::endl;
+ s << endl;
}
const QVector<const AbstractMetaType *> &containers = instantiatedContainers();
s << "// C++ to Python conversion for type '" << container->cppSignature() << "'.\n";
writeContainerConverterFunctions(s, container);
}
- s << Qt::endl;
+ s << endl;
}
s << "#if defined _WIN32 || defined __CYGWIN__\n";
// module inject-code target/beginning
if (!snips.isEmpty()) {
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::TargetLangCode);
- s << Qt::endl;
+ s << endl;
}
for (const QString &requiredModule : requiredModules) {
s << classPythonDefines;
if (!typeConversions.isEmpty()) {
- s << Qt::endl;
+ s << endl;
for (const CustomConversion *conversion : typeConversions) {
writePrimitiveConverterInitialization(s, conversion);
- s << Qt::endl;
+ s << endl;
}
}
if (!containers.isEmpty()) {
- s << Qt::endl;
+ s << endl;
for (const AbstractMetaType *container : containers) {
writeContainerConverterInitialization(s, container);
- s << Qt::endl;
+ s << endl;
}
}
if (!extendedConverters.isEmpty()) {
- s << Qt::endl;
+ s << endl;
for (ExtendedConverterData::const_iterator it = extendedConverters.cbegin(), end = extendedConverters.cend(); it != end; ++it) {
writeExtendedConverterInitialization(s, it.key(), it.value());
- s << Qt::endl;
+ s << endl;
}
}
if (!referencedType)
continue;
QString converter = converterObject(referencedType);
- QStringList cppSignature = pte->qualifiedCppName().split(QLatin1String("::"), Qt::SkipEmptyParts);
+ QStringList cppSignature = pte->qualifiedCppName().split(QLatin1String("::"), QString::SkipEmptyParts);
while (!cppSignature.isEmpty()) {
QString signature = cppSignature.join(QLatin1String("::"));
s << INDENT << "Shiboken::Conversions::registerConverterName(" << converter << ", \"" << signature << "\");\n";
}
}
- s << Qt::endl;
+ s << endl;
if (maxTypeIndex)
s << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");\n";
s << INDENT << "Shiboken::Module::registerTypeConverters(module, " << convertersVariableName() << ");\n";
- s << Qt::endl << INDENT << "if (PyErr_Occurred()) {\n";
+ s << endl << INDENT << "if (PyErr_Occurred()) {\n";
{
Indentation indentation(INDENT);
s << INDENT << "PyErr_Print();\n";
// module inject-code target/end
if (!snips.isEmpty()) {
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionEnd, TypeSystem::TargetLangCode);
- s << Qt::endl;
+ s << endl;
}
// module inject-code native/end
if (!snips.isEmpty()) {
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode);
- s << Qt::endl;
+ s << endl;
}
if (usePySideExtensions()) {
s << INDENT << "FinishSignatureInitialization(module, " << moduleName()
<< "_SignatureStrings);\n";
- s << Qt::endl;
+ s << endl;
s << "SBK_MODULE_INIT_FUNCTION_END\n";
return file.done() != FileOut::Failure;
{
Indentation indent(INDENT);
s << INDENT << "PyErr_SetString(PyExc_IndexError, \"" << errorMsg << "\");\n";
- s << INDENT << returnStatement(m_currentErrorCode) << Qt::endl;
+ s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
s << INDENT << "}\n";
}