summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-06-07 18:41:41 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2020-07-08 08:45:49 +0200
commit631127126cc14e7c01cc611532b3256b58785670 (patch)
treea89608313761f045129f6579d5c96d781d64ff31 /src/tools/moc/generator.cpp
parenta55e938fb41dfb781cdef6a4e24961a272d2dbab (diff)
Introduce QByteArrayView
Created a QByteArrayView in symmetry with QStringView. Added the basic tests symmetrical to QStringView tests. Moved the implementations of non-modifying methods of QByteArray to namespace QtPrivate, to be reused inline from both QByteArray and QByteArrayView. Changed QByteArray's counterparts of those methods to take QByteArrayView as argument instead of QByteArray. Removed QByteArray's operator QNoImplicitBoolCast(), because it was causing ambiguity when calling those methods with QByteArray argument (it was there to perevnt if(!ba)/if(ba) from compiling, but currently that would be ambiguous and won't compile anyway). [ChangeLog][QtCore][QByteArrayView] New class. Task-number: QTBUG-84321 Change-Id: I05f92e654cf65c95f2bb31b9c9018746ac110426 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 5178e90471..39640b6f68 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -164,7 +164,8 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
;
for (const QByteArray &smartPointer : smartPointers) {
- if (propertyType.startsWith(smartPointer + "<") && !propertyType.endsWith("&"))
+ QByteArray ba = smartPointer + "<";
+ if (propertyType.startsWith(ba) && !propertyType.endsWith("&"))
return knownQObjectClasses.contains(propertyType.mid(smartPointer.size() + 1, propertyType.size() - smartPointer.size() - 1 - 1));
}
@@ -174,7 +175,8 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
#undef STREAM_1ARG_TEMPLATE
;
for (const QByteArray &oneArgTemplateType : oneArgTemplates) {
- if (propertyType.startsWith(oneArgTemplateType + "<") && propertyType.endsWith(">")) {
+ QByteArray ba = oneArgTemplateType + "<";
+ if (propertyType.startsWith(ba) && propertyType.endsWith(">")) {
const int argumentSize = propertyType.size() - oneArgTemplateType.size() - 1
// The closing '>'
- 1