@@ -53,15 +53,15 @@ bool ShellGenerator::shouldGenerate(const AbstractMetaClass *meta_class) const
53
53
return ((cg & TypeEntry::GenerateCode) != 0 );
54
54
}
55
55
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 )
57
57
{
58
58
if ((options & OriginalTypeDescription) && !type->originalTypeDescription ().isEmpty ()) {
59
59
s << type->originalTypeDescription ();
60
60
return ;
61
61
}
62
62
63
63
if (type->isArray ()) {
64
- writeTypeInfo (s, type->arrayElementType (), options);
64
+ writeTypeInfo (s, type->arrayElementType (), options, ownership );
65
65
if (options & ArrayAsPointer) {
66
66
s << " *" ;
67
67
} else {
@@ -72,7 +72,7 @@ void ShellGenerator::writeTypeInfo(QTextStream &s, const AbstractMetaType *type,
72
72
73
73
const TypeEntry *te = type->typeEntry ();
74
74
75
- if (type->isConstant () && !(options & ExcludeConst))
75
+ if (type->isConstant () && !(options & ExcludeConst) && !(ownership!=TypeSystem::InvalidOwnership && type-> isReference ()) )
76
76
s << " const " ;
77
77
78
78
if ((options & EnumAsInts) && (te->isEnum () || te->isFlags ())) {
@@ -111,7 +111,7 @@ void ShellGenerator::writeTypeInfo(QTextStream &s, const AbstractMetaType *type,
111
111
112
112
s << QString (type->indirections (), ' *' );
113
113
114
- if (type->isReference () && !(options & ExcludeReference) && !(options & ConvertReferenceToPtr))
114
+ if (type->isReference () && !(options & ExcludeReference) && !(options & ConvertReferenceToPtr) && !(ownership != TypeSystem::InvalidOwnership && type-> isReference ()) )
115
115
s << " &" ;
116
116
117
117
if (type->isReference () && (options & ConvertReferenceToPtr)) {
@@ -142,7 +142,7 @@ void ShellGenerator::writeFunctionArguments(QTextStream &s,
142
142
if (option & AddOwnershipTemplates) {
143
143
ownership = writeOwnershipTemplate (s, meta_function, i+1 );
144
144
}
145
- writeTypeInfo (s, arg->type (), option);
145
+ writeTypeInfo (s, arg->type (), option, ownership );
146
146
if (ownership != TypeSystem::InvalidOwnership) {
147
147
s << " > " ;
148
148
}
@@ -209,7 +209,7 @@ void ShellGenerator::writeFunctionSignature(QTextStream &s,
209
209
if (option & AddOwnershipTemplates) {
210
210
ownership = writeOwnershipTemplate (s, meta_function, 0 );
211
211
}
212
- writeTypeInfo (s, function_type, option);
212
+ writeTypeInfo (s, function_type, option, ownership );
213
213
s << " " ;
214
214
if (ownership != TypeSystem::InvalidOwnership) {
215
215
s << " > " ;
0 commit comments