summaryrefslogtreecommitdiff
path: root/src/qdoc/generator.cpp
diff options
context:
space:
mode:
authorThibaut Cuvelier <cuvelier.thibaut@gmail.com>2019-12-13 02:16:54 +0100
committerPaul Wicking <paul.wicking@qt.io>2019-12-13 13:05:44 +0100
commitb74034a3bcedee3cb1489f17a028a7680bfc5d98 (patch)
tree9d08f911d1fa978dabe902cbc3ce436f89ce70dc /src/qdoc/generator.cpp
parent6aea32abeae3d8bb21cb554987c22e183343890b (diff)
downloadqttools-b74034a3bcedee3cb1489f17a028a7680bfc5d98.tar.gz
Factor out the formatting of the "since" text
Change-Id: I3ec3342eb3362664c605c4120238566d87c8b176 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/generator.cpp')
-rw-r--r--src/qdoc/generator.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index fe2b56b7a..a65b47333 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -1337,28 +1337,32 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m
}
}
+QString Generator::formatSince(const Node *node)
+{
+ QStringList since = node->since().split(QLatin1Char(' '));
+
+ // If there is only one argument, assume it is the Qt version number.
+ if (since.count() == 1)
+ return "Qt " + since[0];
+
+ // Otherwise, use the original <project> <version> string.
+ return node->since();
+}
+
void Generator::generateSince(const Node *node, CodeMarker *marker)
{
if (!node->since().isEmpty()) {
Text text;
text << Atom::ParaLeft
<< "This "
- << typeString(node);
+ << typeString(node)
+ << " was introduced ";
if (node->isEnumType())
- text << " was introduced or modified in ";
- else
- text << " was introduced in ";
-
- QStringList since = node->since().split(QLatin1Char(' '));
- if (since.count() == 1) {
- // If there is only one argument, assume it is the Qt version number.
- text << " Qt " << since[0];
- } else {
- // Otherwise, reconstruct the <project> <version> string.
- text << " " << since.join(' ');
- }
-
- text << "." << Atom::ParaRight;
+ text << "or modified ";
+ text << "in "
+ << formatSince(node)
+ << "."
+ << Atom::ParaRight;
generateText(text, node, marker);
}
}