Skip to content

Commit b0056bc

Browse files
author
florianlink
committed
added support for QList ownership passing
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@377 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
1 parent e2a1eee commit b0056bc

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

generator/shellgenerator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ bool ShellGenerator::shouldGenerate(const AbstractMetaClass *meta_class) const
5353
return ((cg & TypeEntry::GenerateCode) != 0);
5454
}
5555

56-
void ShellGenerator::writeTypeInfo(QTextStream &s, const AbstractMetaType *type, Option options)
56+
void ShellGenerator::writeTypeInfo(QTextStream &s, const AbstractMetaType *type, Option options, TypeSystem::Ownership ownership)
5757
{
5858
if ((options & OriginalTypeDescription) && !type->originalTypeDescription().isEmpty()) {
5959
s << type->originalTypeDescription();
6060
return;
6161
}
6262

6363
if (type->isArray()) {
64-
writeTypeInfo(s, type->arrayElementType(), options);
64+
writeTypeInfo(s, type->arrayElementType(), options, ownership);
6565
if (options & ArrayAsPointer) {
6666
s << "*";
6767
} else {
@@ -72,7 +72,7 @@ void ShellGenerator::writeTypeInfo(QTextStream &s, const AbstractMetaType *type,
7272

7373
const TypeEntry *te = type->typeEntry();
7474

75-
if (type->isConstant() && !(options & ExcludeConst))
75+
if (type->isConstant() && !(options & ExcludeConst) && !(ownership!=TypeSystem::InvalidOwnership && type->isReference()) )
7676
s << "const ";
7777

7878
if ((options & EnumAsInts) && (te->isEnum() || te->isFlags())) {
@@ -111,7 +111,7 @@ void ShellGenerator::writeTypeInfo(QTextStream &s, const AbstractMetaType *type,
111111

112112
s << QString(type->indirections(), '*');
113113

114-
if (type->isReference() && !(options & ExcludeReference) && !(options & ConvertReferenceToPtr))
114+
if (type->isReference() && !(options & ExcludeReference) && !(options & ConvertReferenceToPtr) && !(ownership != TypeSystem::InvalidOwnership && type->isReference()))
115115
s << "&";
116116

117117
if (type->isReference() && (options & ConvertReferenceToPtr)) {
@@ -142,7 +142,7 @@ void ShellGenerator::writeFunctionArguments(QTextStream &s,
142142
if (option & AddOwnershipTemplates) {
143143
ownership = writeOwnershipTemplate(s, meta_function, i+1);
144144
}
145-
writeTypeInfo(s, arg->type(), option);
145+
writeTypeInfo(s, arg->type(), option, ownership);
146146
if (ownership != TypeSystem::InvalidOwnership) {
147147
s << "> ";
148148
}
@@ -209,7 +209,7 @@ void ShellGenerator::writeFunctionSignature(QTextStream &s,
209209
if (option & AddOwnershipTemplates) {
210210
ownership = writeOwnershipTemplate(s, meta_function, 0);
211211
}
212-
writeTypeInfo(s, function_type, option);
212+
writeTypeInfo(s, function_type, option, ownership);
213213
s << " ";
214214
if (ownership != TypeSystem::InvalidOwnership) {
215215
s << "> ";

generator/shellgenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ShellGenerator : public Generator
5858
return "generated_cpp/" + cls->package().replace(".", "_") + "/";
5959
}
6060

61-
void writeTypeInfo(QTextStream &s, const AbstractMetaType *type, Option option = NoOption);
61+
void writeTypeInfo(QTextStream &s, const AbstractMetaType *type, Option option = NoOption, TypeSystem::Ownership ownership = TypeSystem::InvalidOwnership);
6262
void writeFunctionSignature(QTextStream &s, const AbstractMetaFunction *meta_function,
6363
const AbstractMetaClass *implementor = 0,
6464
const QString &name_prefix = QString(),

generator/typesystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,5 +2029,6 @@ QByteArray TypeSystem::normalizedSignature(const char* signature)
20292029
result.replace("qulonglong", "ulonglong");
20302030
result.replace("qint64", "longlong");
20312031
result.replace("quint64", "ulonglong");
2032+
result.replace("QStringList<QString>", "QStringList");
20322033
return result;
20332034
}

0 commit comments

Comments
 (0)