summaryrefslogtreecommitdiff
path: root/src/qdoc/qdoc/utilities.h
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2023-05-15 11:10:23 +0200
committerPaul Wicking <paul.wicking@qt.io>2023-05-15 14:56:54 +0200
commit24085ee19751fa39db5f70d2d850ff5b82a7e400 (patch)
tree94dff7645e21cab80126abd6cef6c8c86b992c86 /src/qdoc/qdoc/utilities.h
parent52c8f1dbdd52f6c6e5e5419a55c456c832d8cdf4 (diff)
downloadqttools-24085ee19751fa39db5f70d2d850ff5b82a7e400.tar.gz
QDoc: Merge Doc::canonicalTitle and Utilities::canonicalizeFileName
Following recent bug fixes in QDoc, it has become apparent that the implementations of `Utilities::canonicalizeFileName` and `Doc::canonicalTitle` are mostly identical. This violates the DRY principle. The use of the former method to normalize generate values for HTML class attributes, shows that the problem the method solves is also closely related to generating HTML. The latter method specifically generates "URL friendly" strings for fragment identifiers in URLs. This indicates that both methods are poorly named, and that they both see use relating to the same problem domain. This patch merges the two implementations to reduce code duplication. `Doc::canonicalTitle` is removed, and `Utilities::canonicalizeFileName` is renamed to `asAsciiPrintable` to better represent its purpose. The documentation is updated. All call sites are updated to use the new method. As there is no unit test for either method, no tests are modified. Fixes: QTBUG-113606 Change-Id: I1fd6a654075fdf8e719bf504b1d702737dd1e42e Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/qdoc/utilities.h')
-rw-r--r--src/qdoc/qdoc/utilities.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qdoc/qdoc/utilities.h b/src/qdoc/qdoc/utilities.h
index 998da48d3..0d485f650 100644
--- a/src/qdoc/qdoc/utilities.h
+++ b/src/qdoc/qdoc/utilities.h
@@ -19,7 +19,7 @@ bool debugging();
QString separator(qsizetype wordPosition, qsizetype numberOfWords);
QString comma(qsizetype wordPosition, qsizetype numberOfWords);
-QString canonicalizeFileName(const QString &name);
+QString asAsciiPrintable(const QString &name);
QStringList getInternalIncludePaths(const QString &compiler);
}