@@ -162,22 +162,44 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c
162
162
s << " class " << promoterClassName (meta_class)
163
163
<< " : public " << meta_class->qualifiedCppName () << endl << " { public:" << endl;
164
164
165
- s << " friend class " << wrapperClassName (meta_class) << " ;" << endl;
166
-
165
+ AbstractMetaEnumList enums1 = meta_class->enums ();
166
+ qSort (enums1.begin (), enums1.end (), enum_lessThan);
167
+ foreach (AbstractMetaEnum* enum1, enums1) {
168
+ if (enum1->wasProtected ()) {
169
+ s << " enum " << enum1->name () << " {" << endl;
170
+ bool first = true ;
171
+ QString scope = meta_class->qualifiedCppName ();
172
+ foreach (AbstractMetaEnumValue* value, enum1->values ()) {
173
+ if (first) { first = false ; }
174
+ else { s << " , " ; }
175
+ s << " " << value->name () << " = " << scope << " ::" << value->name ();
176
+ }
177
+ s << " };" << endl;
178
+ }
179
+ }
180
+
167
181
foreach (AbstractMetaFunction* fun, promoteFunctions) {
168
182
s << " inline " ;
169
183
writeFunctionSignature (s, fun, 0 , " promoted_" ,
170
- Option (IncludeDefaultExpression | OriginalName | ShowStatic | UnderscoreSpaces));
184
+ Option (IncludeDefaultExpression | OriginalName | ShowStatic | UnderscoreSpaces | ProtectedEnumAsInts ));
171
185
s << " { " ;
172
186
QString scriptFunctionName = fun->originalName ();
173
187
AbstractMetaArgumentList args = fun->arguments ();
174
- if (fun->type ())
188
+ if (fun->type ()) {
175
189
s << " return " ;
190
+ }
176
191
s << meta_class->qualifiedCppName () << " ::" ;
177
192
s << fun->originalName () << " (" ;
178
193
for (int i = 0 ; i < args.size (); ++i) {
179
- if (i > 0 )
194
+ if (i > 0 ) {
180
195
s << " , " ;
196
+ }
197
+ if (args.at (i)->type ()->isEnum ()) {
198
+ AbstractMetaEnum* enumType = m_classes.findEnum ((EnumTypeEntry *)args.at (i)->type ()->typeEntry ());
199
+ if (enumType && enumType->wasProtected ()) {
200
+ s << " (" << enumType->typeEntry ()->qualifiedCppName () << " )" ;
201
+ }
202
+ }
181
203
s << args.at (i)->argumentName ();
182
204
}
183
205
s << " ); }" << endl;
@@ -291,7 +313,7 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c
291
313
if (!function->isSlot () || function->isVirtual ()) {
292
314
s << " " ;
293
315
writeFunctionSignature (s, function, 0 , QString (),
294
- Option (ConvertReferenceToPtr | FirstArgIsWrappedObject| IncludeDefaultExpression | OriginalName | ShowStatic | UnderscoreSpaces));
316
+ Option (ConvertReferenceToPtr | FirstArgIsWrappedObject | IncludeDefaultExpression | OriginalName | ShowStatic | UnderscoreSpaces | ProtectedEnumAsInts ));
295
317
s << " ;" << endl;
296
318
}
297
319
}
0 commit comments