summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBrett Stottlemyer <bstottle@ford.com>2021-08-16 13:23:47 -0400
committerBrett Stottlemyer <bstottle@ford.com>2021-08-17 21:04:59 -0400
commit852bf3649876e03c156ae5dc9688833a98ab3d65 (patch)
treeef68f226fd7aaf1116130f27e3acf73b7b5f380a /tools
parent4bf86077a1377bf6babfd362a3e8e546153d8973 (diff)
Handle enums/flags as hash/map keys
This extends the previous commit to allow enums in hash/map containers. Pick-to: 6.2 Change-Id: Iaea9f9ddcbf2e01a611e20800305ebbf236eeada Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/repc/repcodegenerator.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/repc/repcodegenerator.cpp b/tools/repc/repcodegenerator.cpp
index c4913f8..56dd785 100644
--- a/tools/repc/repcodegenerator.cpp
+++ b/tools/repc/repcodegenerator.cpp
@@ -89,11 +89,16 @@ static bool hasScopedEnum(const ASTClass &classContext)
static QString fullyQualifiedTypeName(const ASTClass& classContext, const QString &className, const QString &typeName)
{
- if (isClassEnum(classContext, typeName)) {
- // type was defined in this class' context, prefix typeName with class name
- return className + QStringLiteral("::") + typeName;
+ static const QRegularExpression re = QRegularExpression(QLatin1String("([^<>,\\s]+)"));
+ QString copy = typeName;
+ qsizetype offset = 0;
+ for (const QRegularExpressionMatch &match : re.globalMatch(typeName)) {
+ if (isClassEnum(classContext, match.captured(1))) {
+ copy.insert(match.capturedStart(1) + offset, className + QStringLiteral("::"));
+ offset += className.length() + 2;
+ }
}
- return typeName;
+ return copy;
}
// for enums we need to transform signal/slot arguments to include the class scope