diff options
author | Luca Di Sera <luca.disera@qt.io> | 2022-09-23 11:41:20 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2022-09-23 16:13:30 +0200 |
commit | 94c25f9c164cdfa8592e09e890c425a12cc99fd9 (patch) | |
tree | 3bcdb426b8e6b7eaf78407a70d2cea0872438343 /src/qdoc/sections.cpp | |
parent | b23f3d6c92b10f68973dff05338fcb7eaadc46a3 (diff) |
QDoc: Remove the second parameter of Section::sortName
`Section::sortName`, an internal method that specifies an ordering over
`Node`s that is used to sort the incoming `Node`s into the category maps
used by a `Section`, accepts two parameters.
The first parameter is a `Node` pointer, from which a sortable `QString`
is extracted starting with the node's name.
The second parameter is a `const QString` (unnecessarily a pointer),
that is used as the base of the sortable `QString` instead of the node's
name if it is passed in.
The only usage of the second parameter is in `Section::add`, where
`sortName` is called referencing a `QString` that is the name of the
node passed to `sortName`.
That is, the only usage of the parameter results in the same behavior of
a unary call.
Hence, the second parameter is removed from `SortName`, as it is
unnecessary.
The declaration of `sortName` in the header file was modified to adhere
to the new interface.
The definition of `sortName` in the cpp file was modifierd to adhere to
the new interface and the code branching on the parameter was removed
from it.
The single call site of `sortName/2` was modified to avoid passing a
second argument.
The documentation for `sortName` was modified to remove any reference to
the second parameter.
Change-Id: I4d145eacd865b560a63cdde6beafafdc959bb184
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/sections.cpp')
-rw-r--r-- | src/qdoc/sections.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp index 76f69d11a..452295940 100644 --- a/src/qdoc/sections.cpp +++ b/src/qdoc/sections.cpp @@ -158,16 +158,12 @@ void Section::clear() /*! Construct a name for the \a node that can be used for sorting - a set of nodes into equivalence classes. If \a name is provided, - start with that name. Otherwise start with the name in \a node. + a set of nodes into equivalence classes. */ -QString Section::sortName(const Node *node, const QString *name) +QString Section::sortName(const Node *node) { - QString nodeName; - if (name != nullptr) - nodeName = *name; - else - nodeName = node->name(); + QString nodeName{node->name()}; + int numDigits = 0; for (qsizetype i = nodeName.size() - 1; i > 0; --i) { if (nodeName.at(i).digitValue() == -1) @@ -303,8 +299,7 @@ ClassMap *Section::newClassMap(const Aggregate *aggregate) */ void Section::add(ClassMap *classMap, Node *n) { - QString key = n->name(); - key = sortName(n, &key); + const QString key = sortName(n); m_memberMap.insert(key, n); classMap->second.insert(key, n); } |