summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/cppcodemarker.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-07-22 14:19:07 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-07-23 07:43:20 +0000
commit67638d08b482150f2bace66b4836e278b73cc214 (patch)
treef235fc70c217807e42ae372ec61b7be774777069 /src/tools/qdoc/cppcodemarker.cpp
parent6508365c0498fdf08dc65ff7309f8e01e6f979ed (diff)
Optimize CppCodeMarker::addMarkUp()
This cuts away another 15% of the running time of qdoc -prepare. Change-Id: I81bc32fa191b73fad5d7bd27ff22ac845f83a9ce Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/cppcodemarker.cpp')
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 9aec902860..6060339762 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -893,8 +893,8 @@ QString CppCodeMarker::addMarkUp(const QString &in,
ch = (i < (int)code.length()) ? code[i++].cell() : EOF
QString code = in;
- QStringList out;
- QString text;
+ QString out;
+ QStringRef text;
int braceDepth = 0;
int parenDepth = 0;
int i = 0;
@@ -1069,27 +1069,34 @@ QString CppCodeMarker::addMarkUp(const QString &in,
}
}
- text = code.mid(start, finish - start);
+ text = code.midRef(start, finish - start);
start = finish;
if (!tag.isEmpty()) {
- out << QStringLiteral("<@") << tag;
- if (target)
- out << QStringLiteral(" target=\"") << text << QStringLiteral("()\"");
- out << QStringLiteral(">");
+ out += QStringLiteral("<@");
+ out += tag;
+ if (target) {
+ out += QStringLiteral(" target=\"");
+ out += text;
+ out += QStringLiteral("()\"");
+ }
+ out += QStringLiteral(">");
}
- out << protect(text);
+ out += protect(text);
- if (!tag.isEmpty())
- out << QStringLiteral("</@") << tag << QStringLiteral(">");
+ if (!tag.isEmpty()) {
+ out += QStringLiteral("</@");
+ out += tag;
+ out += QStringLiteral(">");
+ }
}
if (start < code.length()) {
- out << protect(code.mid(start));
+ out += protect(code.midRef(start));
}
- return out.join(QString());
+ return out;
}
/*!