diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-25 10:26:08 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-26 11:21:15 +0000 |
commit | 4d3e1cb2b200736c923e65d13bc34cc91ac117da (patch) | |
tree | ed89c539b72878282f4d6950e9dd37a8c09c8d75 | |
parent | cf51e2f33fa9ce28c3e822d75fcc87dfeaeed4b1 (diff) |
qdbusxml2cpp: port classNameForInterface() to QStringRef
... and QStringBuilder.
Found while fixing Q_FOREACH/foreach use in src/tools,
thus contains port to range-for as a drive-by.
Change-Id: I221bb8cb1f0fc3edeabfdb37d5d5a17551ee8d36
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
-rw-r--r-- | src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 513f36ae64..54050afbe6 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -306,17 +306,14 @@ static QString classNameForInterface(const QString &interface, ClassType classTy if (!globalClassName.isEmpty()) return globalClassName; - QStringList parts = interface.split(QLatin1Char('.')); + const auto parts = interface.splitRef(QLatin1Char('.')); QString retval; - if (classType == Proxy) - foreach (QString part, parts) { - part[0] = part[0].toUpper(); - retval += part; - } - else { - retval = parts.last(); - retval[0] = retval[0].toUpper(); + if (classType == Proxy) { + for (const auto &part : parts) + retval += part[0].toUpper() + part.mid(1); + } else { + retval += parts.last()[0].toUpper() + parts.last().mid(1); } if (classType == Proxy) |