82 auto legal_ascii = [](
const uint value) {
83 const uint start_ascii_subset{ 32 };
84 const uint end_ascii_subset{ 126 };
86 return value >= start_ascii_subset && value <= end_ascii_subset;
91 bool has_non_alnum_content{
false };
93 for (
const auto &c : str) {
94 char16_t u = c.unicode();
96 has_non_alnum_content =
true;
97 if (u >=
'A' && u <=
'Z')
99 if ((u >=
'a' && u <=
'z') || (u >=
'0' && u <=
'9')) {
100 result += QLatin1Char(u);
103 result += QLatin1Char(
'-');
107 if (result.endsWith(QLatin1Char(
'-')))
110 if (has_non_alnum_content) {
111 auto title_hash = QString::fromLocal8Bit(
112 QCryptographicHash::hash(str.toUtf8(), QCryptographicHash::Md5).toHex());
113 title_hash.truncate(8);
114 if (!result.isEmpty())
115 result.append(QLatin1Char(
'-'));
116 result.append(title_hash);
Pure string helpers with no dependencies on QDoc driver types.
QString protect(const QString &string)
QString asAsciiPrintable(const QString &name)
Returns an ASCII-printable representation of str.
QString separator(qsizetype wordPosition, qsizetype numberOfWords)
QString comma(qsizetype wordPosition, qsizetype numberOfWords)