30#include <QtCore/qlist.h>
31#include <QtCore/qmap.h>
32#include <QtCore/quuid.h>
33#include <QtCore/qversionnumber.h>
34#include <QtCore/qregularexpression.h>
43using namespace Qt::StringLiterals;
50static const auto headingStart =
"<h3 class=\"%1\" translate=\"no\" id=\"%2\">"_L1;
55static void addLink(
const QString &linkTarget, QStringView nestedStuff, QString *res)
57 if (!linkTarget.isEmpty()) {
58 *res += QLatin1String(
"<a href=\"");
60 *res += QLatin1String(
"\" translate=\"no\">");
62 *res += QLatin1String(
"</a>");
82 if (param.template_declaration) {
83 appendTemplateParametersAtoms(out, *param.template_declaration);
89 if (param.concept_name) {
90 const QString fq = QString::fromStdString(*param.concept_name);
101 if (!decl
.type.empty())
102 out << Atom(Atom::AutoLink, QString::fromStdString(decl.type));
105 out <<
"typename"_L1;
112 if (!decl.name.empty())
113 out <<
" "_L1 << QString::fromStdString(decl.name);
118 out <<
"template <"_L1;
121 for (
const auto ¶m : storage.parameters) {
122 if (param.sfinae_constraint)
127 appendTemplateParameterAtoms(out, param);
142 appendTemplateParametersAtoms(out, templateDecl);
144 if (!templateDecl.requires_clause || templateDecl.requires_clause->empty())
147 out <<
" requires "_L1;
148 const QString text = QString::fromStdString(*templateDecl.requires_clause);
150 QStringList concepts;
151 concepts.reserve(
int(templateDecl.referenced_concepts.size()));
152 for (
const auto &s : templateDecl.referenced_concepts)
153 concepts.append(QString::fromStdString(s));
155 if (concepts.isEmpty()) {
163 std::sort(concepts.begin(), concepts.end(),
164 [](
const QString &a,
const QString &b) {
return a.size() > b.size(); });
166 struct Match { qsizetype offset; qsizetype length; QString name; };
167 QList<Match> matches;
168 QList<
bool> occupied(text.size(),
false);
170 for (
const QString &concept_name : concepts) {
171 const QString unqualified = concept_name.section(
"::"_L1, -1);
172 QRegularExpression re(
"\\b"_L1 + QRegularExpression::escape(unqualified) +
"\\b"_L1);
173 auto it = re.globalMatch(text);
174 while (it.hasNext()) {
175 const auto m = it.next();
176 const qsizetype start = m.capturedStart();
177 const qsizetype len = m.capturedLength();
179 for (qsizetype i = start; i < start + len; ++i)
180 if (occupied[i]) { clear =
false;
break; }
183 for (qsizetype i = start; i < start + len; ++i)
185 matches.append({start, len, unqualified});
189 std::sort(matches.begin(), matches.end(),
190 [](
const Match &a,
const Match &b) {
return a.offset < b.offset; });
193 for (
const auto &m : matches) {
195 out << text.mid(pos, m.offset - pos);
196 out << Atom(Atom::AutoLink, m.name);
197 pos = m.offset + m.length;
199 if (pos < text.size())
200 out << text.mid(pos);
204
205
206
207
210 auto result{classSet};
212 result +=
" internal"_L1;
217
218
219
222 if (!s_inUnorderedList) {
224 s_inUnorderedList =
true;
229
230
231
234 if (s_inUnorderedList) {
236 s_inUnorderedList =
false;
241
242
243
246 if (m_helpProjectWriter) {
247 delete m_helpProjectWriter;
248 m_helpProjectWriter =
nullptr;
251 if (m_manifestWriter) {
252 delete m_manifestWriter;
253 m_manifestWriter =
nullptr;
258
259
260
280 {
nullptr,
nullptr,
nullptr } };
283 config = &Config::instance();
286
287
288
289 for (
int i = 0; defaults[i].key; ++i) {
290 formattingLeftMap().insert(QLatin1String(defaults[i].key), QLatin1String(defaults[i].left));
291 formattingRightMap().insert(QLatin1String(defaults[i].key),
292 QLatin1String(defaults[i].right));
295 QString formatDot{HtmlGenerator::format() + Config::dot};
296 m_endHeader = config->get(formatDot +
CONFIG_ENDHEADER).asString(
"</head>\n<body>\n"_L1);
310 .asString(m_project +
" Reference Documentation"_L1);
312 m_projectUrl = config->get(
CONFIG_URL).asString();
321
322
323
324
326 delete m_helpProjectWriter;
327 m_helpProjectWriter =
nullptr;
328 }
else if (m_helpProjectWriter) {
329 m_helpProjectWriter->reset(m_project.toLower() +
".qhp",
this);
331 m_helpProjectWriter =
new HelpProjectWriter(m_project.toLower() +
".qhp",
this);
334 if (!m_manifestWriter)
347 .asString(m_homepage);
354 .asString(m_landingpage);
361 .asString(
"C++ Classes"_L1);
368 .asString(
"QML Types"_L1);
377
378
390
391
392
393
394
395
396
402 Node *qflags = m_qdb->findClassNode(QStringList(
"QFlags"_L1));
404 m_qflagsHref = linkForNode(qflags,
nullptr);
408 const QString fileBase =
"%1/%2"_L1.arg(
410 m_project.toLower().simplified().replace(
' '_L1,
'-'_L1)
414 if (m_helpProjectWriter)
418 const QString &rootTitle = m_landingpage.isEmpty() ? m_homepage : m_landingpage;
419 tocWriter
.generateTOC(
"%1_toc.xml"_L1.arg(fileBase), rootTitle);
421
422
423 if (!tagFile_.isEmpty()) {
431
432
435 SubTitleSize subTitleSize = LargeSubTitle;
436 QString fullTitle = en->fullTitle();
438 beginSubPage(en, linkForExampleFile(resolved_file.get_query()));
439 generateHeader(fullTitle, en, marker, u"auto-generated"_s);
440 generateTitle(en
->doc().title(),
Text() << en->subtitle(), subTitleSize, en, marker);
445 QString code = quoter.quoteTo(en->location(), QString(), QString());
446 CodeMarker *codeMarker = CodeMarker::markerForFileName(resolved_file.get_path());
450 generateText(text, en, codeMarker);
455
456
459 qsizetype idx, skipAhead = 0;
460 static bool in_para =
false;
461 Genus genus = Genus::DontCare;
463 if (!m_inSectionHeading && atom->type() != Atom::Target
464 && atom->type() != Atom::SectionHeadingRight)
465 m_recentSectionRef.clear();
469 QString name = atom->string();
470 if (relative && relative->name() == name.replace(QLatin1String(
"()"), QLatin1String())) {
471 out() << protectEnc(atom->string());
479 if (!m_inLink && !m_inContents && !m_inSectionHeading) {
480 const Node *node =
nullptr;
481 QString link = getAutoLink(atom, relative, &node, genus);
482 if (link.isEmpty()) {
487 QStringLiteral(
"Can't autolink to '%1'").arg(atom->string()));
492 if (link.isEmpty()) {
493 out() << protectEnc(atom->string());
495 beginLink(link, node, relative);
500 out() << protectEnc(atom->string());
512 skipAhead = skipAtoms(atom, Atom::DeprecatedRight) + 1;
520 skipAhead = skipAtoms(atom, Atom::BriefRight);
535 out() << protectEnc(plainCode(atom->string()));
539 out() <<
"<p class=\"figCaption\">";
550 out() <<
"<pre class=\"qml\" translate=\"no\"><code class=\"qml\">"
551 << trimmedTrailing(highlightedCode(indent(m_codeIndent, atom->string()), relative,
553 m_codePrefix, m_codeSuffix)
554 <<
"</code></pre>\n";
558 if (atom->strings().count() == 2)
559 out() <<
"<pre class=\"" << atom->string(1) <<
"\" translate=\"no\"><code class=\"" << atom->string(1) <<
"\">";
561 out() <<
"<pre class=\"cpp\" translate=\"no\"><code class=\"cpp\">";
563 out() << trimmedTrailing(highlightedCode(indent(m_codeIndent, atom->string()), relative),
564 m_codePrefix, m_codeSuffix)
565 <<
"</code></pre>\n";
568 out() <<
"<pre class=\"cpp plain\" translate=\"no\"><code class=\"text\">"
569 << trimmedTrailing(protectEnc(plainCode(indent(m_codeIndent, atom->string()))),
570 m_codePrefix, m_codeSuffix)
571 <<
"</code></pre>\n";
574 out() <<
"<details>\n";
576 out() <<
"<summary>...</summary>\n";
579 out() <<
"<summary>";
582 out() <<
"</summary>\n";
585 out() <<
"</details>\n";
589 if (!atom->string().isEmpty())
590 out() <<
' ' << atom->string();
613 if (atom->string().startsWith(
"span "))
614 out() <<
'<' + atom->string() <<
'>';
616 out() << formattingLeftMap()[atom->string()];
624 const Node *node{
nullptr};
625 const Atom tm_link(Atom::NavLink, m_trademarkspage);
626 if (
const auto &link = getLink(&tm_link, relative, &node);
627 !link.isEmpty() && node != relative)
628 out() <<
"<a href=\"%1\">%2</a>"_L1.arg(link, formattingRightMap()[atom->string()]);
630 out() << formattingRightMap()[atom->string()];
633 }
else if (atom->string().startsWith(
"span ")) {
636 out() << formattingRightMap()[atom->string()];
640 if (
const auto *cn = m_qdb->getCollectionNode(atom->string(), NodeType::Group); cn)
641 generateList(cn, marker, atom->string(), Generator::sortOrder(atom->strings().last()));
644 const auto sortOrder{Generator::sortOrder(atom->strings().last())};
645 if (atom->string() == QLatin1String(
"annotatedclasses")) {
646 generateAnnotatedList(relative, marker, m_qdb->getCppClasses().values(), sortOrder);
647 }
else if (atom->string() == QLatin1String(
"annotatedexamples")) {
648 generateAnnotatedLists(relative, marker, m_qdb->getExamples());
649 }
else if (atom->string() == QLatin1String(
"annotatedattributions")) {
650 generateAnnotatedLists(relative, marker, m_qdb->getAttributions());
651 }
else if (atom->string() == QLatin1String(
"classes")) {
652 generateCompactList(Generic, relative, m_qdb->getCppClasses(),
true,
654 }
else if (atom->string().contains(
"classes ")) {
655 QString rootName = atom->string().mid(atom->string().indexOf(
"classes") + 7).trimmed();
656 generateCompactList(Generic, relative, m_qdb->getCppClasses(),
true, rootName);
657 }
else if (atom->string() == QLatin1String(
"qmlvaluetypes")
658 || atom->string() == QLatin1String(
"qmlbasictypes")) {
659 generateCompactList(Generic, relative, m_qdb->getQmlValueTypes(),
true,
661 }
else if (atom->string() == QLatin1String(
"qmltypes")) {
662 generateCompactList(Generic, relative, m_qdb->getQmlTypes(),
true, QStringLiteral(
""));
663 }
else if ((idx = atom->string().indexOf(QStringLiteral(
"bymodule"))) != -1) {
665 QString moduleName = atom->string().mid(idx + 8).trimmed();
667 if (
const auto *cn = qdb->getCollectionNode(moduleName, moduleType)) {
669 switch (moduleType) {
673 generateAnnotatedList(relative, marker, map.values(), sortOrder);
676 if (atom->string().contains(QLatin1String(
"qmlvaluetypes")))
680 generateAnnotatedList(relative, marker, map.values(), sortOrder);
683 generateAnnotatedList(relative, marker, cn->members(), sortOrder);
687 }
else if (atom->string() == QLatin1String(
"classhierarchy")) {
688 generateClassHierarchy(relative, m_qdb->getCppClasses());
689 }
else if (atom->string() == QLatin1String(
"obsoleteclasses")) {
690 generateCompactList(Generic, relative, m_qdb->getObsoleteClasses(),
false,
691 QStringLiteral(
"Q"));
692 }
else if (atom->string() == QLatin1String(
"obsoleteqmltypes")) {
693 generateCompactList(Generic, relative, m_qdb->getObsoleteQmlTypes(),
false,
695 }
else if (atom->string() == QLatin1String(
"obsoletecppmembers")) {
696 generateCompactList(Obsolete, relative, m_qdb->getClassesWithObsoleteMembers(),
false,
697 QStringLiteral(
"Q"));
698 }
else if (atom->string() == QLatin1String(
"obsoleteqmlmembers")) {
699 generateCompactList(Obsolete, relative, m_qdb->getQmlTypesWithObsoleteMembers(),
false,
701 }
else if (atom->string() == QLatin1String(
"functionindex")) {
702 generateFunctionIndex(relative);
703 }
else if (atom->string() == QLatin1String(
"attributions")) {
704 generateAnnotatedList(relative, marker, m_qdb->getAttributions().values(), sortOrder);
705 }
else if (atom->string() == QLatin1String(
"legalese")) {
706 generateLegaleseList(relative, marker);
707 }
else if (atom->string() == QLatin1String(
"overviews")) {
708 generateList(relative, marker,
"overviews", sortOrder);
709 }
else if (atom->string() == QLatin1String(
"cpp-modules")) {
710 generateList(relative, marker,
"cpp-modules", sortOrder);
711 }
else if (atom->string() == QLatin1String(
"qml-modules")) {
712 generateList(relative, marker,
"qml-modules", sortOrder);
713 }
else if (atom->string() == QLatin1String(
"namespaces")) {
714 generateAnnotatedList(relative, marker, m_qdb->getNamespaces().values(), sortOrder);
715 }
else if (atom->string() == QLatin1String(
"related")) {
716 generateList(relative, marker,
"related", sortOrder);
718 const CollectionNode *cn = m_qdb->getCollectionNode(atom->string(), NodeType::Group);
720 if (!generateGroupList(
const_cast<CollectionNode *>(cn), sortOrder))
722 QString(
"'\\generatelist %1' group is empty").arg(atom->string()));
725 QString(
"'\\generatelist %1' no such group").arg(atom->string()));
730 const NodeMultiMap &nsmap = m_qdb->getSinceMap(atom->string());
734 const NodeMultiMap &ncmap = m_qdb->getClassMap(atom->string());
735 const NodeMultiMap &nqcmap = m_qdb->getQmlTypeMap(atom->string());
740 for (
const auto §ion : sinceSections) {
741 if (!section.members().isEmpty()) {
743 <<
"<a href=\"#" << TextUtils::asAsciiPrintable(section.title()) <<
"\">"
744 << section.title() <<
"</a></li>\n";
750 for (
const auto §ion : sinceSections) {
751 if (!section.members().isEmpty()) {
752 out() <<
"<h3 id=\"" << TextUtils::asAsciiPrintable(section.title()) <<
"\">"
753 << protectEnc(section.title()) <<
"</h3>\n";
754 if (index == Sections::SinceClasses)
755 generateCompactList(Generic, relative, ncmap,
false, QStringLiteral(
"Q"));
756 else if (index == Sections::SinceQmlTypes)
757 generateCompactList(Generic, relative, nqcmap,
false, QStringLiteral(
""));
758 else if (index == Sections::SinceMemberFunctions
759 || index == Sections::SinceQmlMethods
760 || index == Sections::SinceQmlProperties) {
762 QMap<QString, NodeMultiMap> parentmaps;
764 const QList<Node *> &members = section.members();
765 for (
const auto &member : members) {
766 QString parent_full_name = (*member).parent()->fullName();
768 auto parent_entry = parentmaps.find(parent_full_name);
769 if (parent_entry == parentmaps.end())
770 parent_entry = parentmaps.insert(parent_full_name, NodeMultiMap());
771 parent_entry->insert(member->name(), member);
774 for (
auto map = parentmaps.begin(); map != parentmaps.end(); ++map) {
775 NodeVector nv = map->values().toVector();
776 auto parent = nv.front()->parent();
778 out() << ((index == Sections::SinceMemberFunctions) ?
"<p>Class " :
"<p>QML Type ");
780 out() <<
"<a href=\"" << linkForNode(parent, relative) <<
"\" translate=\"no\">";
781 QStringList pieces = parent->fullName().split(
"::");
782 out() << protectEnc(pieces.last());
786 generateSection(nv, relative, marker);
789 }
else if (index == Sections::SinceEnumValues) {
790 out() <<
"<div class=\"table\"><table class=\"alignedsummary\" translate=\"no\">\n";
791 const auto map_it = m_qdb->newEnumValueMaps().constFind(atom->string());
792 for (
auto it = map_it->cbegin(); it != map_it->cend(); ++it) {
793 out() <<
"<tr><td class=\"memItemLeft\"> enum value </td><td class=\"memItemRight\">"
794 <<
"<b><a href=\"" << linkForNode(it.value(),
nullptr) <<
"\">"
795 << it.key() <<
"</a></b></td></tr>\n";
797 out() <<
"</table></div>\n";
799 generateSection(section.members(), relative, marker);
817 out() <<
"<p class=\"centerAlign\">";
819 auto maybe_resolved_file{file_resolver.resolve(atom->string())};
820 if (!maybe_resolved_file) {
823 QStringLiteral(
"Missing image: %1").arg(protectEnc(atom->string())));
824 out() <<
"<font color=\"red\">[Missing image " << protectEnc(atom->string())
828 QString file_name{QFileInfo{file.get_path()}.fileName()};
848 "%1/%2"_L1.arg(outputDir(), imagesOutputDir()));
850 const auto &imgPath =
"%1/%2"_L1.arg(imagesOutputDir(), file_name);
852 out() <<
"<img src=\"%1\""_L1.arg(protectEnc(imgPath));
854 const QString altAndTitleText = protectEnc(text);
855 out() <<
" alt=\"" << altAndTitleText;
857 out() <<
"\" title=\"" << altAndTitleText;
861 if (m_helpProjectWriter)
862 m_helpProjectWriter->addExtraFile(imgPath);
863 setImageFileName(relative, imgPath);
875 QString admonType = atom->typeString();
878 out() <<
"<div class=\"admonition " << admonType.toLower() <<
"\">\n"
881 out() << admonType <<
": ";
891 out() <<
"<div class=\"LegaleseLeft\">";
905 const Node *node =
nullptr;
906 QString link = getLink(atom, relative, &node);
908 Location location = atom->isLinkAtom() ?
static_cast<
const LinkAtom*>(atom)->location
909 : relative->doc().location();
911 QStringLiteral(
"Can't link to '%1'").arg(atom->string()));
913 beginLink(link, node, relative);
917 QString link = linkForExampleFile(atom->string());
922 QString link = atom->string();
923 link =
"images/used-in-examples/" + link;
928 const Node *node =
static_cast<
const Node*>(
Utilities::nodeForString(atom->string()));
929 beginLink(linkForNode(node, relative), node, relative);
942 out() << R"(<div class="table"><table class="valuelist">)";
943 m_threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom);
944 if (m_threeColumnEnumValueTable) {
945 if (++m_numTableRows % 2 == 1)
946 out() << R"(<tr valign="top" class="odd">)";
948 out() << R"(<tr valign="top" class="even">)";
950 out() <<
"<th class=\"tblConst\">Constant</th>";
954 out() <<
"<th class=\"tblval\">Value</th>";
956 out() <<
"<th class=\"tbldscr\">Description</th></tr>\n";
958 out() <<
"<tr><th class=\"tblConst\">Constant</th><th "
959 "class=\"tblVal\">Value</th></tr>\n";
976 out() << QString(R"(<ol class="%1" type="%1" start="%2">)")
977 .arg(olType, atom
->next()->string());
979 out() << QString(R"(<ol class="%1" type="%1">)").arg(olType);
988 std::pair<QString,
int> pair = getAtomListValue(atom);
989 skipAhead = pair.second;
990 QString t = protectEnc(plainCode(marker->markedUpEnumValue(pair.first, relative)));
991 out() <<
"<tr><td class=\"topAlign\"><code translate=\"no\">" << t <<
"</code>";
994 out() <<
"</td><td class=\"topAlign tblval\">";
995 const auto *enume =
static_cast<
const EnumNode *>(relative);
996 QString itemValue = enume->itemValue(atom->next()->string());
997 if (itemValue.isEmpty())
1000 out() <<
"<code translate=\"no\">" << protectEnc(itemValue) <<
"</code>";
1013 if (m_threeColumnEnumValueTable) {
1014 out() <<
"</td><td class=\"topAlign\">";
1021 if (matchAhead(atom, Atom::ParaLeft))
1028 out() <<
"</td></tr>\n";
1039 out() <<
"</table></div>\n";
1060 out() <<
"<blockquote>";
1063 out() <<
"</blockquote>\n";
1066 out() << atom->string();
1072 int unit = atom->string().toInt() +
hOffset(relative
);
1073 m_recentSectionRef = Tree::refForAtom(atom);
1074 out() <<
"<h" + QString::number(unit) + QLatin1Char(
' ') <<
"id=\""
1075 << m_recentSectionRef <<
"\">";
1076 m_inSectionHeading =
true;
1080 out() <<
"</h" + QString::number(atom->string().toInt() + hOffset(relative)) +
">\n";
1081 m_inSectionHeading =
false;
1088 if (m_inLink && !m_inContents && !m_inSectionHeading) {
1091 out() << protectEnc(atom->string());
1095 std::pair<QString, QString> pair = getTableWidthAttr(atom);
1096 QString attr = pair.second;
1097 QString width = pair.first;
1104 out() << R"(<div class="table"><table class=")" << attr <<
'"';
1105 if (!width.isEmpty())
1106 out() <<
" style=\"width: " << width <<
'"';
1111 out() <<
"</table></div>\n";
1114 out() <<
"<thead><tr class=\"qt-style\">";
1115 m_inTableHeader =
true;
1121 out() <<
"\n<tr class=\"qt-style\">";
1123 out() <<
"</thead>\n";
1124 m_inTableHeader =
false;
1128 if (!atom->string().isEmpty())
1129 out() <<
"<tr " << atom->string() <<
'>';
1130 else if (++m_numTableRows % 2 == 1)
1131 out() << R"(<tr valign="top" class="odd">)";
1133 out() << R"(<tr valign="top" class="even">)";
1139 if (m_inTableHeader)
1144 for (
int i = 0; i < atom->count(); ++i) {
1147 const QString &p = atom->string(i);
1148 if (p.contains(
'=')) {
1151 QStringList spans = p.split(QLatin1Char(
','));
1152 if (spans.size() == 2) {
1153 if (spans.at(0) !=
"1")
1154 out() <<
" colspan=\"" << spans.at(0) <<
'"';
1155 if (spans.at(1) !=
"1")
1156 out() <<
" rowspan=\"" << spans.at(1) <<
'"';
1161 if (matchAhead(atom, Atom::ParaLeft))
1165 if (m_inTableHeader)
1170 if (matchAhead(atom, Atom::ParaLeft))
1180 const QString ref = atom->count() == 2 ? atom->string(1)
1181 : TextUtils::asAsciiPrintable(atom->string());
1182 const Atom *next = atom;
1186 if (ref != m_recentSectionRef && (!section || Tree::refForAtom(section) != ref))
1187 out() <<
"<span id=\"" << ref <<
"\"></span>";
1191 out() <<
"<b class=\"redFont\"><Missing HTML></b>";
1193 case Atom::UnknownCommand:
1194 out() << R"(<b class="redFont"><code translate=\"no\">\)" << protectEnc(atom->string()) <<
"</code></b>";
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1242 auto link_for_group = [
this](
const CollectionNode *group) -> QString {
1243 QString target{linkForNode(group,
nullptr)};
1244 return (target.isEmpty()) ? protectEnc(group->name()) :
"<a href=\"" + target +
"\">" + protectEnc(group->fullTitle()) +
"</a>";
1249 const QStringList &groups_names{node->groupNames()};
1250 if (groups_names.isEmpty())
1253 std::vector<CollectionNode *> groups_nodes(groups_names.size(),
nullptr);
1254 std::transform(groups_names.cbegin(), groups_names.cend(), groups_nodes.begin(),
1257 m_qdb->mergeCollections(group);
1258 return (group && group
->wasSeen()) ? group :
nullptr;
1260 groups_nodes.erase(
std::remove(groups_nodes.begin(), groups_nodes.end(),
nullptr), groups_nodes.end());
1262 if (!groups_nodes.empty()) {
1263 text += node->name() +
" is part of ";
1265 for (std::vector<CollectionNode *>::size_type index{0}; index < groups_nodes.size(); ++index) {
1266 text += link_for_group(groups_nodes[index]) + TextUtils::separator(index, groups_nodes.size());
1273
1274
1275
1276
1287 QString typeWord = aggregate->typeWord(
true);
1290 fullTitle = aggregate->plainFullName();
1291 title =
"%1 %2"_L1.arg(fullTitle, typeWord);
1292 ns =
static_cast<NamespaceNode *>(aggregate);
1294 fullTitle = aggregate->plainFullName();
1295 title =
"%1 %2"_L1.arg(fullTitle, typeWord);
1297 title = fullTitle = aggregate->fullTitle();
1298 if (!aggregate->doc().title().isEmpty())
1299 titleText << aggregate->name() <<
" - "_L1 << aggregate->doc().title();
1304 if (aggregate
->parent()->isInAPI() || templateDecl) {
1306 appendTemplateDeclAtoms(subtitleText, *templateDecl);
1307 subtitleText <<
" "_L1;
1309 subtitleText << aggregate->typeWord(
false) <<
" "_L1;
1310 auto ancestors = fullTitle.split(
"::"_L1);
1311 ancestors.pop_back();
1312 for (
const auto &a : ancestors)
1313 subtitleText << Atom(Atom::AutoLink, a) <<
"::"_L1;
1314 subtitleText << aggregate->plainName();
1317 generateHeader(title, aggregate, marker);
1318 generateTableOfContents(aggregate, marker, &summarySections);
1320 generateTitle(titleText, subtitleText, SmallSubTitle, aggregate, marker);
1322 generateTitle(title, subtitleText, SmallSubTitle, aggregate, marker);
1326 brief <<
"The " << ns->name() <<
" namespace includes the following elements from module "
1329 addNodeLink(brief, fullNamespace,
" here.");
1331 generateText(brief, ns, marker);
1334 generateBrief(aggregate, marker);
1336 const auto parentIsClass = aggregate
->parent()->isClassNode();
1339 generateRequisites(aggregate, marker);
1344 QString membersLink = generateAllMembersFile(sections.allMembersSection(), marker);
1345 if (!membersLink.isEmpty()) {
1346 openUnorderedList();
1347 out() <<
"<li><a href=\"" << membersLink <<
"\">"
1348 <<
"List of all members, including inherited members</a></li>\n";
1350 QString obsoleteLink = generateObsoleteMembersFile(sections, marker);
1351 if (!obsoleteLink.isEmpty()) {
1352 openUnorderedList();
1353 out() <<
"<li><a href=\"" << obsoleteLink <<
"\">"
1354 <<
"Deprecated members</a></li>\n";
1357 if (QString groups_text{groupReferenceText(aggregate)}; !groups_text.isEmpty()) {
1358 openUnorderedList();
1360 out() <<
"<li>" << groups_text <<
"</li>\n";
1363 closeUnorderedList();
1368 bool needOtherSection =
false;
1370 for (
const auto §ion : summarySections) {
1371 if (section.members().isEmpty() && section.reimplementedMembers().isEmpty()) {
1372 if (!section.inheritedMembers().isEmpty())
1373 needOtherSection =
true;
1375 if (!section.members().isEmpty()) {
1376 QString ref = registerRef(section.title().toLower());
1377 out() <<
"<h2 id=\"" << ref <<
"\">" << protectEnc(section.title()) <<
"</h2>\n";
1378 generateSection(section.members(), aggregate, marker);
1380 if (!section.reimplementedMembers().isEmpty()) {
1381 QString name = QString(
"Reimplemented ") + section.title();
1382 QString ref = registerRef(name.toLower());
1383 out() <<
"<h2 id=\"" << ref <<
"\">" << protectEnc(name) <<
"</h2>\n";
1384 generateSection(section.reimplementedMembers(), aggregate, marker);
1387 if (!section.inheritedMembers().isEmpty()) {
1389 generateSectionInheritedList(section, aggregate);
1395 if (needOtherSection) {
1396 out() <<
"<h3>Additional Inherited Members</h3>\n"
1399 for (
const auto §ion : summarySections) {
1400 if (section.members().isEmpty() && !section.inheritedMembers().isEmpty())
1401 generateSectionInheritedList(section, aggregate);
1406 if (aggregate
->doc().isEmpty()) {
1407 QString command =
"documentation";
1409 command = R"('\class' comment)";
1412 QStringLiteral(
"No %1 for '%2'").arg(command, aggregate->plainSignature()));
1415 generateExtractionMark(aggregate, DetailedDescriptionMark);
1416 out() <<
"<div class=\"descr\">\n"
1417 <<
"<h2 id=\"" << registerRef(
"details") <<
"\">"
1418 <<
"Detailed Description"
1421 out() <<
"</div>\n";
1422 generateAlsoList(aggregate, marker);
1423 generateExtractionMark(aggregate, EndMark);
1426 for (
const auto §ion : detailsSections) {
1427 bool headerGenerated =
false;
1428 if (section.isEmpty())
1431 const QList<Node *> &members = section.members();
1432 for (
const auto &member : members) {
1433 if (!headerGenerated) {
1434 if (!section.divClass().isEmpty())
1435 out() <<
"<div class=\"" << section.divClass() <<
"\">\n";
1436 out() <<
"<h2>" << protectEnc(section.title()) <<
"</h2>\n";
1437 headerGenerated =
true;
1439 if (!member->isClassNode())
1440 generateDetailedMember(member, aggregate, marker);
1443 if (
const auto &attrs = getClassAttr(member,
""_L1); !attrs.isEmpty())
1444 out() <<
" class=\"%1\""_L1.arg(attrs);
1445 out() <<
"> class ";
1446 generateFullName(member, aggregate);
1448 generateBrief(member, marker, aggregate);
1451 if (headerGenerated && !section.divClass().isEmpty())
1452 out() <<
"</div>\n";
1454 generateFooter(aggregate);
1467 QString rawTitle = aggregate->plainName();
1468 QString fullTitle = aggregate->plainFullName();
1469 QString title = rawTitle +
" Proxy Page";
1470 generateHeader(title, aggregate, marker, u"auto-generated"_s);
1471 generateTitle(title, subtitleText, SmallSubTitle, aggregate, marker);
1472 generateBrief(aggregate, marker);
1473 for (
const auto §ion : summarySections) {
1474 if (!section.members().isEmpty()) {
1475 QString ref = registerRef(section.title().toLower());
1476 out() <<
"<h2 id=\"" << ref <<
"\">" << protectEnc(section.title()) <<
"</h2>\n";
1477 generateSection(section.members(), aggregate, marker);
1481 if (!aggregate
->doc().isEmpty()) {
1482 generateExtractionMark(aggregate, DetailedDescriptionMark);
1483 out() <<
"<div class=\"descr\">\n"
1484 <<
"<h2 id=\"" << registerRef(
"details") <<
"\">"
1485 <<
"Detailed Description"
1488 out() <<
"</div>\n";
1489 generateAlsoList(aggregate, marker);
1490 generateExtractionMark(aggregate, EndMark);
1493 for (
const auto §ion : detailsSections) {
1494 if (section.isEmpty())
1497 if (!section.divClass().isEmpty())
1498 out() <<
"<div class=\"" << section.divClass() <<
"\">\n";
1499 out() <<
"<h2>" << protectEnc(section.title()) <<
"</h2>\n";
1501 const QList<Node *> &members = section.members();
1502 for (
const auto &member : members) {
1503 if (!member->isClassNode()) {
1504 generateDetailedMember(member, aggregate, marker);
1507 if (
const auto &attrs = getClassAttr(member,
""_L1); !attrs.isEmpty())
1508 out() <<
" class=\"%1\""_L1.arg(attrs);
1509 out() <<
"> class ";
1510 generateFullName(member, aggregate);
1512 generateBrief(member, marker, aggregate);
1515 if (!section.divClass().isEmpty())
1516 out() <<
"</div>\n";
1518 generateFooter(aggregate);
1522
1523
1524
1528 SubTitleSize subTitleSize = LargeSubTitle;
1529 QString htmlTitle = qcn->name();
1531 htmlTitle.append(
" QML Value Type");
1533 htmlTitle.append(
" QML Type");
1536 htmlTitle.append(
" (Singleton)"_L1);
1538 htmlTitle.append(
" (Uncreatable)"_L1);
1540 generateHeader(htmlTitle, qcn, marker);
1543 marker = CodeMarker::markerForLanguage(QLatin1String(
"QML"));
1544 generateTitle(htmlTitle,
Text() << qcn->subtitle(), subTitleSize, qcn, marker);
1545 generateBrief(qcn, marker);
1546 generateQmlRequisites(qcn, marker);
1550 out() <<
"<p><strong>Note:</strong> This type is a QML singleton. "_L1
1551 <<
"There is only one instance of this type in the QML engine.</p>\n"_L1;
1553 out() <<
"<p><strong>Note:</strong> This is an uncreatable type. "_L1
1554 <<
"It cannot be instantiated in QML.</p>\n"_L1;
1557 QString allQmlMembersLink;
1561 allQmlMembersLink = generateAllQmlMembersFile(sections, marker);
1562 QString obsoleteLink = generateObsoleteQmlMembersFile(sections, marker);
1563 if (!allQmlMembersLink.isEmpty() || !obsoleteLink.isEmpty()) {
1564 openUnorderedList();
1566 if (!allQmlMembersLink.isEmpty()) {
1567 out() <<
"<li><a href=\"" << allQmlMembersLink <<
"\">"
1568 <<
"List of all members, including inherited members</a></li>\n";
1570 if (!obsoleteLink.isEmpty()) {
1571 out() <<
"<li><a href=\"" << obsoleteLink <<
"\">"
1572 <<
"Deprecated members</a></li>\n";
1576 if (QString groups_text{groupReferenceText(qcn)}; !groups_text.isEmpty()) {
1577 openUnorderedList();
1579 out() <<
"<li>" << groups_text <<
"</li>\n";
1582 closeUnorderedList();
1585 for (
const auto §ion : qmlSummarySections) {
1586 if (!section.isEmpty()) {
1587 QString ref = registerRef(section.title().toLower());
1588 out() <<
"<h2 id=\"" << ref <<
"\">" << protectEnc(section.title()) <<
"</h2>\n";
1589 generateQmlSummary(section.members(), qcn, marker);
1593 generateExtractionMark(qcn, DetailedDescriptionMark);
1594 out() <<
"<h2 id=\"" << registerRef(
"details") <<
"\">"
1595 <<
"Detailed Description"
1598 generateAlsoList(qcn, marker);
1599 generateExtractionMark(qcn, EndMark);
1602 for (
const auto §ion : qmlDetailsSections) {
1603 if (section.isEmpty())
1605 out() <<
"<h2>" << protectEnc(section.title()) <<
"</h2>\n";
1606 const QList<Node *> &members = section.members();
1607 for (
const auto member : members)
1608 generateDetailedQmlMember(member, qcn, marker);
1610 generateFooter(qcn);
1615
1616
1617
1620 generateHeader(pn->fullTitle(), pn, marker);
1622
1623
1624
1625 if ((pn->name() != QLatin1String(
"index.html")))
1626 generateTableOfContents(pn, marker,
nullptr);
1628 generateTitle(pn
->doc().title(),
Text() << pn->subtitle(), LargeSubTitle, pn, marker);
1630 generateBrief(pn, marker,
nullptr,
false);
1633 generateExtractionMark(pn, DetailedDescriptionMark);
1634 out() << R"(<div class="descr" id=")" << registerRef(
"details")
1638 out() <<
"</div>\n";
1639 generateAlsoList(pn, marker);
1640 generateExtractionMark(pn, EndMark);
1646
1647
1650 SubTitleSize subTitleSize = LargeSubTitle;
1653 generateHeader(cn->fullTitle(), cn, marker);
1654 generateTableOfContents(cn, marker,
nullptr);
1655 generateTitle(cn
->doc().title(),
Text() << cn->subtitle(), subTitleSize, cn, marker);
1658 if (cn
->genus() != Genus::DOC && cn
->genus() != Genus::DontCare) {
1660 generateBrief(cn, marker);
1668 if (!nmm.isEmpty()) {
1669 ref = registerRef(
"namespaces");
1670 out() <<
"<h2 id=\"" << ref <<
"\">Namespaces</h2>\n";
1671 generateAnnotatedList(cn, marker, nmm.values());
1674 if (!nmm.isEmpty()) {
1675 ref = registerRef(
"classes");
1676 out() <<
"<h2 id=\"" << ref <<
"\">Classes</h2>\n";
1677 generateAnnotatedList(cn, marker, nmm.values());
1683 generateExtractionMark(cn, DetailedDescriptionMark);
1684 ref = registerRef(
"details");
1685 out() <<
"<div class=\"descr\">\n";
1686 out() <<
"<h2 id=\"" << ref <<
"\">"
1687 <<
"Detailed Description"
1690 generateExtractionMark(cn, DetailedDescriptionMark);
1691 out() << R"(<div class="descr" id=")" << registerRef(
"details")
1696 out() <<
"</div>\n";
1697 generateAlsoList(cn, marker);
1698 generateExtractionMark(cn, EndMark);
1703 if (!users.isEmpty()) {
1704 ref = registerRef(
"users");
1705 out() <<
"<h2 id=\"" << ref <<
"\">Used by</h2>\n";
1706 generateAnnotatedList(cn, marker, users);
1709 generateAnnotatedList(cn, marker, cn->members());
1716
1717
1718
1719
1722 SubTitleSize subTitleSize = LargeSubTitle;
1723 QString fullTitle = cn->name();
1725 generateHeader(fullTitle, cn, marker, u"auto-generated"_s);
1726 generateTitle(fullTitle,
Text() << cn->subtitle(), subTitleSize, cn, marker);
1729 brief <<
"Each function or type documented here is related to a class or "
1730 <<
"namespace that is documented in a different module. The reference "
1731 <<
"page for that class or namespace will link to the function or type "
1734 generateText(brief, cn, marker);
1738 for (
const auto &member : members)
1739 generateDetailedMember(member, cn, marker);
1745
1746
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777void HtmlGenerator::generateNavigationBar(
const QString &title,
const Node *node,
1778 CodeMarker *marker,
const QString &buildversion,
1781 if (m_noNavigationBar || node ==
nullptr)
1792 auto addNavItem = [&](
const QString &link,
const QString &title) {
1793 navigationbar << Atom(itemLeft) << Atom(
Atom::NavLink, link)
1800 auto addNavItemNode = [&](
const Node *node,
const QString &title) {
1801 navigationbar << Atom(itemLeft);
1802 addNodeLink(navigationbar, node, title);
1803 navigationbar << Atom(itemRight);
1807 const auto *moduleNode = m_qdb->getModuleNode(node);
1808 QString moduleState;
1809 if (moduleNode && !moduleNode->state().isEmpty())
1810 moduleState = QStringLiteral(
" (%1)").arg(moduleNode->state());
1812 if (m_hometitle == title)
1814 if (!m_homepage.isEmpty())
1815 addNavItem(m_homepage, m_hometitle);
1816 if (!m_landingpage.isEmpty() && m_landingtitle != title)
1817 addNavItem(m_landingpage, m_landingtitle);
1820 const bool hasClassesItem = !m_cppclassespage.isEmpty() && !m_cppclassestitle.isEmpty();
1822 addNavItem(m_cppclassespage, m_cppclassestitle);
1823 if (!node->physicalModuleName().isEmpty()) {
1827 if (moduleNode && (!moduleState.isEmpty() || moduleNode->title() != m_cppclassespage)) {
1828 const QString moduleText = hasClassesItem || moduleNode->title().isEmpty()
1829 ? moduleNode->name() : moduleNode->title();
1830 addNavItemNode(moduleNode, moduleText + moduleState);
1833 navigationbar << Atom(itemLeft) <<
Atom(
Atom::String, node->name()) << Atom(itemRight);
1835 const bool hasTypesItem = !m_qmltypespage.isEmpty() && !m_qmltypestitle.isEmpty();
1837 addNavItem(m_qmltypespage, m_qmltypestitle);
1841 if (moduleNode && (!moduleState.isEmpty() || moduleNode->title() != m_qmltypespage)) {
1842 const QString moduleText = hasTypesItem || moduleNode->title().isEmpty()
1843 ? moduleNode->name() : moduleNode->title();
1844 addNavItemNode(moduleNode, moduleText + moduleState);
1846 navigationbar << Atom(itemLeft) <<
Atom(
Atom::String, node->name()) << Atom(itemRight);
1849 auto currentNode{
static_cast<
const PageNode*>(node)};
1850 std::deque<
const Node *> navNodes;
1852 qsizetype navItems = 0;
1853 while (currentNode->navigationParent() && ++navItems < 16) {
1854 if (
std::find(navNodes.cbegin(), navNodes.cend(),
1855 currentNode->navigationParent()) == navNodes.cend())
1856 navNodes.push_front(currentNode->navigationParent());
1857 currentNode = currentNode->navigationParent();
1861 if (navNodes.empty()) {
1862 const QStringList groups =
static_cast<
const PageNode *>(node)->groupNames();
1863 for (
const auto &groupName : groups) {
1864 const auto *groupNode = m_qdb->findNodeByNameAndType(QStringList{groupName}, &Node::isGroup);
1865 if (groupNode && !groupNode->title().isEmpty()) {
1866 navNodes.push_front(groupNode);
1871 while (!navNodes.empty()) {
1872 if (navNodes.front()->isPageNode())
1873 addNavItemNode(navNodes.front(), navNodes.front()->title());
1874 navNodes.pop_front();
1878 navigationbar << Atom(itemLeft) << Atom(
Atom::String, title) << Atom(itemRight);
1882 generateText(navigationbar, node, marker);
1884 if (buildversion.isEmpty())
1890 out() <<
"</tr></table><table class=\"buildversion\"><tr>\n"
1891 << R"(<td id="buildversion" width="100%" align="right">)";
1893 out() <<
"<li id=\"buildversion\">";
1897 if (!m_landingpage.isEmpty() && m_landingtitle != title) {
1898 navigationbar << Atom(Atom::NavLink, m_landingpage)
1900 << Atom(Atom::String, buildversion)
1902 generateText(navigationbar, node, marker);
1904 out() << buildversion;
1913 const QString &metaKeyword)
1915 out() <<
"<!DOCTYPE html>\n";
1916 out() << QString(
"<html lang=\"%1\">\n").arg(naturalLanguage);
1917 out() <<
"<head>\n";
1918 out() <<
" <meta charset=\"utf-8\">\n";
1923 out() <<
" <meta name=\"description\" content=\""
1924 << protectEnc(node->doc().briefText().toString())
1928 if (!metaKeyword.isEmpty()) {
1930 out() <<
" <meta name=\"keywords\" content=\"%1\">\n"_L1.arg(protectEnc(metaKeyword));
1933 QStringList keywords;
1935 for (
const auto &kw : metaTags->values(u"keywords"_s))
1936 keywords << kw.split(
','_L1, Qt::SkipEmptyParts);
1941 keywords << node->nodeTypeString().toLower().remove(
' '_L1);
1943 if (!keywords.isEmpty()) {
1944 std::transform(keywords.begin(), keywords.end(), keywords.begin(),
1945 [](
const QString &k) {
return k.trimmed(); });
1946 keywords.removeDuplicates();
1947 out() <<
" <meta name=\"keywords\" content=\"" << protectEnc(keywords.join(
','_L1))
1953 QString titleSuffix;
1954 if (!m_landingtitle.isEmpty()) {
1956 titleSuffix = m_landingtitle;
1957 }
else if (!m_hometitle.isEmpty()) {
1960 if (title != m_hometitle)
1961 titleSuffix = m_hometitle;
1964 titleSuffix = m_productName.isEmpty() ? m_project : m_productName;
1966 if (title == titleSuffix)
1967 titleSuffix.clear();
1969 out() <<
" <title>";
1970 if (!titleSuffix.isEmpty() && !title.isEmpty()) {
1971 out() <<
"%1 | %2"_L1.arg(protectEnc(title), titleSuffix);
1973 out() << protectEnc(title);
1978 QVersionNumber projectVersion = QVersionNumber::fromString(m_qdb->version());
1979 if (!projectVersion.isNull()) {
1980 QVersionNumber titleVersion;
1981 static const QRegularExpression re(QLatin1String(R"(\d+\.\d+)"));
1982 const QString &versionedTitle = titleSuffix.isEmpty() ? title : titleSuffix;
1983 auto match = re.match(versionedTitle);
1984 if (match.hasMatch())
1985 titleVersion = QVersionNumber::fromString(match.captured());
1986 if (titleVersion.isNull() || !titleVersion.isPrefixOf(projectVersion)) {
1988 if (!m_productName.isEmpty() && titleSuffix != m_productName)
1989 out() <<
" | %1"_L1.arg(m_productName);
1990 out() <<
" %1"_L1.arg(projectVersion.toString());
1993 out() <<
"</title>\n";
1996 out() << m_headerStyles;
1997 out() << m_headerScripts;
1998 out() << m_endHeader;
2001 bool usingTable = m_postHeader.trimmed().endsWith(QLatin1String(
"<tr>"));
2002 generateNavigationBar(title, node, marker, m_buildversion, usingTable);
2003 out() << QString(m_postPostHeader).replace(
"\\" +
COMMAND_VERSION, m_qdb->version());
2005 m_navigationLinks.clear();
2007 m_recentSectionRef.clear();
2008 m_emittedMemberRefs.clear();
2010 if (node && !node->links().empty()) {
2011 std::pair<QString, QString> linkPair;
2012 std::pair<QString, QString> anchorPair;
2013 const Node *linkNode;
2014 bool useSeparator =
false;
2018 linkNode = m_qdb->findNodeForTarget(linkPair.first, node);
2021 QStringLiteral(
"Cannot link to '%1'").arg(linkPair.first));
2022 if (linkNode ==
nullptr || linkNode == node)
2023 anchorPair = linkPair;
2025 anchorPair = anchorForNode(linkNode);
2027 out() << R"( <link rel="prev" href=")" << anchorPair.first <<
"\" />\n";
2029 m_navigationLinks += R"(<a class="prevPage" href=")" + anchorPair.first +
"\">";
2030 if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
2031 m_navigationLinks += protect(anchorPair.second);
2033 m_navigationLinks += protect(linkPair.second);
2034 m_navigationLinks +=
"</a>\n";
2035 useSeparator = !m_navigationSeparator.isEmpty();
2039 linkNode = m_qdb->findNodeForTarget(linkPair.first, node);
2042 QStringLiteral(
"Cannot link to '%1'").arg(linkPair.first));
2043 if (linkNode ==
nullptr || linkNode == node)
2044 anchorPair = linkPair;
2046 anchorPair = anchorForNode(linkNode);
2048 out() << R"( <link rel="next" href=")" << anchorPair.first <<
"\" />\n";
2051 m_navigationLinks += m_navigationSeparator;
2053 m_navigationLinks += R"(<a class="nextPage" href=")" + anchorPair.first +
"\">";
2054 if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty())
2055 m_navigationLinks += protect(anchorPair.second);
2057 m_navigationLinks += protect(linkPair.second);
2058 m_navigationLinks +=
"</a>\n";
2062 linkNode = m_qdb->findNodeForTarget(linkPair.first, node);
2065 QStringLiteral(
"Cannot link to '%1'").arg(linkPair.first));
2066 if (linkNode ==
nullptr || linkNode == node)
2067 anchorPair =
std::move(linkPair);
2069 anchorPair = anchorForNode(linkNode);
2070 out() << R"( <link rel="start" href=")" << anchorPair.first <<
"\" />\n";
2074 if (node && !node->links().empty())
2075 out() <<
"<p class=\"naviNextPrevious headerNavi\">\n" << m_navigationLinks <<
"</p>\n";
2079 SubTitleSize subTitleSize,
const Node *relative,
2085 attribute = R"( translate="no")";
2088 out() <<
"<h1 class=\"title\"" << attribute <<
">";
2089 generateText(title, relative, marker);
2094 if (subTitleSize == SmallSubTitle)
2095 out() <<
" class=\"small-subtitle\"" << attribute <<
">";
2097 out() <<
" class=\"subtitle\"" << attribute <<
">";
2098 generateText(subtitle, relative, marker);
2099 out() <<
"</span>\n";
2105 if (node && !node->links().empty())
2106 out() <<
"<p class=\"naviNextPrevious footerNavi\">\n" << m_navigationLinks <<
"</p>\n";
2108 out() << QString(m_footer).replace(
"\\" +
COMMAND_VERSION, m_qdb->version())
2109 << QString(m_address).replace(
"\\" +
COMMAND_VERSION, m_qdb->version());
2111 out() <<
"</body>\n";
2112 out() <<
"</html>\n";
2116
2117
2118
2121 QMap<QString, Text> requisites;
2124 const QString headerText =
"Header";
2125 const QString sinceText =
"Since";
2126 const QString inheritedByText =
"Inherited By";
2127 const QString inheritsText =
"Inherits";
2128 const QString nativeTypeText =
"In QML";
2129 const QString qtVariableText =
"qmake";
2130 const QString cmakeText =
"CMake";
2131 const QString statusText =
"Status";
2134 const QStringList requisiteorder { headerText, cmakeText, qtVariableText, sinceText,
2135 nativeTypeText, inheritsText, inheritedByText, statusText };
2137 addIncludeFileToMap(aggregate, requisites, text, headerText);
2138 addSinceToMap(aggregate, requisites, &text, sinceText);
2141 addCMakeInfoToMap(aggregate, requisites, &text, cmakeText);
2142 addQtVariableToMap(aggregate, requisites, &text, qtVariableText);
2146 auto *classe =
dynamic_cast<
ClassNode *>(aggregate);
2148 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
2150 if (InclusionFilter::isIncluded(policy, context))
2151 addQmlNativeTypesToMap(requisites, &text, nativeTypeText, classe);
2154 const auto *metaTags = classe ? classe
->doc().metaTagMap() :
nullptr;
2155 if (!metaTags || !metaTags->contains(u"qdoc-suppress-inheritance"_s))
2156 addInheritsToMap(requisites, &text, inheritsText, classe);
2157 addInheritedByToMap(requisites, &text, inheritedByText, classe);
2161 addStatusToMap(aggregate, requisites, text, statusText);
2163 if (!requisites.isEmpty()) {
2165 generateTheTable(requisiteorder, requisites, aggregate, marker);
2170
2171
2172void HtmlGenerator::generateTheTable(
const QStringList &requisiteOrder,
2173 const QMap<QString, Text> &requisites,
2176 out() <<
"<div class=\"table\"><table class=\"alignedsummary requisites\" translate=\"no\">\n";
2178 for (
auto it = requisiteOrder.constBegin(); it != requisiteOrder.constEnd(); ++it) {
2180 if (requisites.contains(*it)) {
2182 <<
"<td class=\"memItemLeft rightAlign topAlign\"> " << *it
2184 "</td><td class=\"memItemRight bottomAlign\"> ";
2186 generateText(requisites.value(*it), aggregate, marker);
2187 out() <<
"</td></tr>\n";
2190 out() <<
"</table></div>\n";
2194
2195
2196
2197void HtmlGenerator::addInheritedByToMap(QMap<QString, Text> &requisites,
Text *text,
2198 const QString &inheritedByText,
ClassNode *classe)
2200 if (!classe->derivedClasses().isEmpty()) {
2203 int count = appendSortedNames(*text, classe, classe->derivedClasses());
2206 requisites.insert(inheritedByText, *text);
2211
2212
2213
2214void HtmlGenerator::addInheritsToMap(QMap<QString, Text> &requisites,
Text *text,
2215 const QString &inheritsText,
ClassNode *classe)
2217 if (!classe->baseClasses().isEmpty()) {
2220 const auto baseClasses = classe->baseClasses();
2221 for (
const auto &cls : baseClasses) {
2223 appendFullName(*text, cls.m_node, classe);
2225 if (cls.m_access == Access::Protected) {
2226 *text <<
" (protected)";
2227 }
else if (cls.m_access == Access::Private) {
2228 *text <<
" (private)";
2230 *text << TextUtils::comma(index++, classe->baseClasses().size());
2235 requisites.insert(inheritsText, *text);
2240
2241
2242
2243void HtmlGenerator::addQmlNativeTypesToMap(QMap<QString, Text> &requisites,
Text *text,
2244 const QString &nativeTypeText,
ClassNode *classe)
const
2251 QList<QmlTypeNode *> nativeTypes { classe->qmlNativeTypes().cbegin(), classe->qmlNativeTypes().cend()};
2253 qsizetype index { 0 };
2255 for (
const auto &item : std::as_const(nativeTypes)) {
2256 addNodeLink(*text, item);
2257 *text << TextUtils::comma(index++, nativeTypes.size());
2259 requisites.insert(nativeTypeText, *text);
2263
2264
2265
2267 Text *text,
const QString &CMakeInfo)
const
2269 if (!aggregate->physicalModuleName().isEmpty() && text !=
nullptr) {
2271 m_qdb->getCollectionNode(aggregate->physicalModuleName(), NodeType::Module);
2273 const auto result = cmakeRequisite(cn);
2286 requisites.insert(CMakeInfo, *text);
2291
2292
2293
2295 Text *text,
const QString &qtVariableText)
const
2297 if (!aggregate->physicalModuleName().isEmpty()) {
2299 m_qdb->getCollectionNode(aggregate->physicalModuleName(), NodeType::Module);
2301 if (cn && !cn->qtVariable().isEmpty()) {
2304 requisites.insert(qtVariableText, *text);
2310
2311
2312
2313
2315 Text *text,
const QString &sinceText)
const
2317 if (!aggregate->since().isEmpty() && text !=
nullptr) {
2320 requisites.insert(sinceText, *text);
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2336 Text &text,
const QString &statusText)
const
2338 auto status{formatStatus(aggregate, m_qdb)};
2344 spanClass = u"deprecated"_s;
2346 spanClass =
TextUtils::asAsciiPrintable(status.value());
2349 text << Atom(Atom::String, status.value())
2351 "class=\"status %1\""_L1.arg(spanClass))
2353 requisites.insert(statusText, text);
2357
2358
2359
2360
2362 QMap<QString, Text> &requisites,
Text& text,
2363 const QString &headerText)
2365 if (aggregate->includeFile()) {
2367 text << openCodeTag <<
"#include <%1>"_L1.arg(*aggregate->includeFile()) << closeCodeTag;
2368 requisites.insert(headerText, text);
2373
2374
2375
2381 QMap<QString, Text> requisites;
2384 const QString importText =
"Import Statement";
2385 const QString sinceText =
"Since";
2386 const QString inheritedByText =
"Inherited By";
2387 const QString inheritsText =
"Inherits";
2388 const QString nativeTypeText =
"In C++";
2389 const QString statusText =
"Status";
2392 QString logicalModuleVersion;
2397 bool generate_import =
true;
2399 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
2403 if (generate_import) {
2407 requisites.insert(importText, text);
2410 qcn
->doc().location().warning(QStringLiteral(
"Could not resolve QML import statement for type '%1'").arg(qcn->name()),
2415 if (!qcn->since().isEmpty()) {
2418 requisites.insert(sinceText, text);
2423 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
2427 addNodeLink(text, cn);
2428 requisites.insert(nativeTypeText, text);
2436 QStringList knownTypeNames{qcn->name()};
2438 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
2446 knownTypeNames << base->name();
2449 addNodeLink(text, base);
2452 for (
const auto sub : std::as_const(subs)) {
2453 if (knownTypeNames.contains(sub->name())) {
2454 text << Atom(Atom::String,
" (%1)"_L1.arg(base->logicalModuleName()));
2459 requisites.insert(inheritsText, text);
2463 if (!subs.isEmpty()) {
2466 int count = appendSortedQmlNames(text, qcn, knownTypeNames, subs);
2469 requisites.insert(inheritedByText, text);
2473 addStatusToMap(qcn, requisites, text, statusText);
2476 const QStringList requisiteorder {
std::move(importText),
std::move(sinceText),
2477 std::move(nativeTypeText),
std::move(inheritsText),
2478 std::move(inheritedByText),
std::move(statusText)};
2480 if (!requisites.isEmpty())
2481 generateTheTable(requisiteorder, requisites, qcn, marker);
2493 QStringLiteral(
"'\\brief' statement does not end with a full stop."));
2495 generateExtractionMark(node, BriefMark);
2497 generateText(brief, node, marker);
2500 if (!relative || node == relative)
2501 out() <<
" <a href=\"#";
2503 out() <<
" <a href=\"" << linkForNode(node, relative) <<
'#';
2504 out() << registerRef(
"details") <<
"\">More...</a>";
2508 generateExtractionMark(node, EndMark);
2513
2514
2515
2521 toc = node
->doc().tableOfContents();
2522 if (tocDepth == 0 || (toc.isEmpty() && !sections && !node
->isModule())) {
2527 int sectionNumber = 1;
2528 int detailsBase = 0;
2531 m_inContents =
true;
2533 out() <<
"<div class=\"sidebar\">\n";
2534 out() <<
"<div class=\"toc\">\n";
2535 out() <<
"<h3 id=\"toc\">Contents</h3>\n";
2538 openUnorderedList();
2539 if (!
static_cast<
const CollectionNode *>(node)->noAutoList()) {
2541 out() <<
"<li class=\"level" << sectionNumber <<
"\"><a href=\"#"
2542 << registerRef(
"namespaces") <<
"\">Namespaces</a></li>\n";
2545 out() <<
"<li class=\"level" << sectionNumber <<
"\"><a href=\"#"
2546 << registerRef(
"classes") <<
"\">Classes</a></li>\n";
2549 out() <<
"<li class=\"level" << sectionNumber <<
"\"><a href=\"#" << registerRef(
"details")
2550 <<
"\">Detailed Description</a></li>\n";
2551 for (
const auto &entry : std::as_const(toc)) {
2552 if (entry->string().toInt() == 1) {
2558 for (
const auto §ion : *sections) {
2559 if (!section.members().isEmpty()) {
2560 openUnorderedList();
2561 out() <<
"<li class=\"level" << sectionNumber <<
"\"><a href=\"#"
2562 << registerRef(section.plural()) <<
"\">" << section.title() <<
"</a></li>\n";
2564 if (!section.reimplementedMembers().isEmpty()) {
2565 openUnorderedList();
2566 QString ref = QString(
"Reimplemented ") + section.plural();
2567 out() <<
"<li class=\"level" << sectionNumber <<
"\"><a href=\"#"
2568 << registerRef(ref.toLower()) <<
"\">"
2569 << QString(
"Reimplemented ") + section.title() <<
"</a></li>\n";
2573 openUnorderedList();
2574 out() <<
"<li class=\"level" << sectionNumber <<
"\"><a href=\"#"
2575 << registerRef(
"details") <<
"\">Detailed Description</a></li>\n";
2577 for (
const auto &entry : toc) {
2578 if (entry->string().toInt() == 1) {
2585 for (
const auto &atom : toc) {
2586 sectionNumber = atom->string().toInt() + detailsBase;
2589 if (sectionNumber <= tocDepth || tocDepth < 0) {
2590 openUnorderedList();
2592 Text headingText = Text::sectionHeading(atom);
2593 out() <<
"<li class=\"level" << sectionNumber <<
"\">";
2594 out() <<
"<a href=\"" <<
'#' << Tree::refForAtom(atom) <<
"\">";
2595 generateAtomList(headingText.firstAtom(), node, marker,
true, numAtoms);
2596 out() <<
"</a></li>\n";
2599 closeUnorderedList();
2600 out() <<
"</div>\n";
2601 out() << R"(<div class="sidebar-content" id="sidebar-content"></div>)";
2602 out() <<
"</div>\n";
2603 m_inContents =
false;
2608
2609
2612 out() <<
"<div class=\"sidebar\">";
2613 out() << R"(<div class="sidebar-content" id="sidebar-content"></div>)";
2614 out() <<
"</div>\n";
2623 QString fileName = fileBase(aggregate) +
"-members." + fileExtension();
2624 beginSubPage(aggregate, fileName);
2625 QString title =
"List of All Members for " + aggregate->plainFullName();
2626 generateHeader(title, aggregate, marker, u"auto-generated"_s);
2628 generateTitle(title,
Text(), SmallSubTitle, aggregate, marker);
2629 out() <<
"<p>This is the complete list of members for ";
2630 generateFullName(aggregate,
nullptr);
2631 out() <<
", including inherited members.</p>\n";
2633 generateSectionList(section, aggregate, marker);
2641
2642
2643
2644
2645
2653 QString fileName = fileBase(aggregate) +
"-members." + fileExtension();
2654 beginSubPage(aggregate, fileName);
2655 QString title =
"List of All Members for " + aggregate->name();
2656 generateHeader(title, aggregate, marker, u"auto-generated"_s);
2658 generateTitle(title,
Text(), SmallSubTitle, aggregate, marker);
2659 out() <<
"<p>This is the complete list of members for ";
2660 generateFullName(aggregate,
nullptr);
2661 out() <<
", including inherited members.</p>\n";
2664 for (
int i = 0; i < cknl.size(); i++) {
2665 const auto &ckn = cknl[i];
2668 if (nodes.isEmpty())
2671 out() <<
"<p>The following members are inherited from ";
2672 generateFullName(qcn,
nullptr);
2675 openUnorderedList();
2676 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
2677 for (
int j = 0; j < nodes.size(); j++) {
2678 Node *node = nodes[j];
2685 std::function<
void(
Node *)> generate = [&](Node *n) {
2686 out() <<
"<li class=\"fn\" translate=\"no\">";
2687 generateQmlItem(n, aggregate, marker,
true);
2688 if (n->isQmlProperty()) {
2689 auto qpn =
static_cast<QmlPropertyNode *>(n);
2690 QStringList hints = qpn->hints();
2691 if (qpn->isAttached())
2692 hints <<
"attached"_L1;
2693 if (!hints.isEmpty())
2694 out() <<
" [" << hints.join(
' '_L1) <<
"]";
2695 }
else if (n->isAttached()) {
2697 out() <<
" [attached]";
2700 if (n->isPropertyGroup()) {
2702 const QList<Node *> &collective =
2703 static_cast<SharedCommentNode *>(n)->collective();
2704 std::for_each(collective.begin(), collective.end(), generate);
2711 closeUnorderedList();
2728 QString title =
"Obsolete Members for " + aggregate->plainFullName();
2729 QString fileName = fileBase(aggregate) +
"-obsolete." + fileExtension();
2731 beginSubPage(aggregate, fileName);
2732 generateHeader(title, aggregate, marker, u"auto-generated"_s);
2734 generateTitle(title,
Text(), SmallSubTitle, aggregate, marker);
2736 out() <<
"<p><b>The following members of class "
2737 <<
"<a href=\"" << linkForNode(aggregate,
nullptr) <<
"\" translate=\"no\">"
2738 << protectEnc(aggregate->name()) <<
"</a>"
2739 <<
" are deprecated.</b> "
2740 <<
"They are provided to keep old source code working. "
2741 <<
"We strongly advise against using them in new code.</p>\n";
2743 for (
const auto §ion : summary_spv) {
2744 out() <<
"<h2>" << protectEnc(section->title()) <<
"</h2>\n";
2745 generateSectionList(*section, aggregate, marker,
true);
2748 for (
const auto §ion : details_spv) {
2749 out() <<
"<h2>" << protectEnc(section->title()) <<
"</h2>\n";
2751 const NodeVector &members = section->obsoleteMembers();
2752 for (
const auto &member : members)
2753 generateDetailedMember(member, aggregate, marker);
2762
2763
2764
2765
2774 QString title =
"Obsolete Members for " + aggregate->name();
2775 QString fileName = fileBase(aggregate) +
"-obsolete." + fileExtension();
2777 beginSubPage(aggregate, fileName);
2778 generateHeader(title, aggregate, marker, u"auto-generated"_s);
2780 generateTitle(title,
Text(), SmallSubTitle, aggregate, marker);
2782 out() <<
"<p><b>The following members of QML type "
2783 <<
"<a href=\"" << linkForNode(aggregate,
nullptr) <<
"\">"
2784 << protectEnc(aggregate->name()) <<
"</a>"
2785 <<
" are deprecated.</b> "
2786 <<
"They are provided to keep old source code working. "
2787 <<
"We strongly advise against using them in new code.</p>\n";
2789 for (
const auto §ion : summary_spv) {
2790 QString ref = registerRef(section->title().toLower());
2791 out() <<
"<h2 id=\"" << ref <<
"\">" << protectEnc(section->title()) <<
"</h2>\n";
2792 generateQmlSummary(section->obsoleteMembers(), aggregate, marker);
2795 for (
const auto §ion : details_spv) {
2796 out() <<
"<h2>" << protectEnc(section->title()) <<
"</h2>\n";
2797 const NodeVector &members = section->obsoleteMembers();
2798 for (
const auto &member : members) {
2799 generateDetailedQmlMember(member, aggregate, marker);
2811 if (classMap.isEmpty())
2815 for (
const auto &it : classMap) {
2816 auto *classe =
static_cast<ClassNode *>(it);
2817 if (classe->baseClasses().isEmpty())
2818 topLevel.insert(classe->name(), classe);
2821 QStack<NodeMap> stack;
2822 stack.push(topLevel);
2825 while (!stack.isEmpty()) {
2826 if (stack.top().isEmpty()) {
2832 generateFullName(child, relative);
2834 stack.top().erase(stack.top().begin());
2837 const auto derivedClasses = child->derivedClasses();
2838 for (
const RelatedClass &d : derivedClasses) {
2839 if (d.m_node && d.m_node->isInAPI())
2840 newTop.insert(d.m_node->name(), d.m_node);
2842 if (!newTop.isEmpty()) {
2851
2852
2853
2858 if (relative ==
nullptr)
2861 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
2862 for (
auto *node : nodes) {
2863 const NodeContext context = node->createContext();
2864 if (InclusionFilter::isIncluded(policy, context) && !node->isDeprecated())
2865 included.insert(node->fullName(relative), node);
2871 const NodeList &unsortedNodes, Qt::SortOrder sortOrder)
2873 generateAnnotatedList(relative, marker, includedAnnotatedMembers(relative, unsortedNodes),
2880 if (nodeMap.isEmpty())
2882 out() <<
"<div class=\"table\"><table class=\"annotated\">\n";
2886 if (sortOrder == Qt::DescendingOrder)
2892 auto sameLocation = [
this](
const Node *a,
const Node *b) {
2893 return fullDocumentLocation(a) == fullDocumentLocation(b);
2895 nodes.erase(
std::unique(nodes.begin(), nodes.end(), sameLocation), nodes.end());
2897 for (
const auto *node : std::as_const(nodes)) {
2899 out() <<
"<tr class=\"odd topAlign\">";
2901 out() <<
"<tr class=\"even topAlign\">";
2902 out() <<
"<td class=\"tblName\" translate=\"no\"><p>";
2903 generateFullName(node, relative);
2904 out() <<
"</p></td>";
2906 if (!node->isTextPageNode()) {
2907 Text brief = node->doc().trimmedBriefText(node->name());
2908 if (!brief.isEmpty()) {
2909 out() <<
"<td class=\"tblDescr\"><p>";
2910 generateText(brief, node, marker);
2911 out() <<
"</p></td>";
2912 }
else if (!node->reconstitutedBrief().isEmpty()) {
2913 out() <<
"<td class=\"tblDescr\"><p>";
2914 out() << node->reconstitutedBrief();
2915 out() <<
"</p></td>";
2918 out() <<
"<td class=\"tblDescr\"><p>";
2919 if (!node->reconstitutedBrief().isEmpty()) {
2920 out() << node->reconstitutedBrief();
2922 out() << protectEnc(node->doc().briefText().toString());
2923 out() <<
"</p></td>";
2927 out() <<
"</table></div>\n";
2931
2932
2933
2937 const auto &uniqueKeys = nmm.uniqueKeys();
2938 for (
const QString &name : uniqueKeys) {
2939 if (!name.isEmpty()) {
2940 out() <<
"<h2 id=\"" << registerRef(name.toLower()) <<
"\">" << protectEnc(name)
2943 generateAnnotatedList(relative, marker, nmm.values(name));
2948
2949
2950
2951
2952
2953
2954
2955
2956
2959 const QString &commonPrefix)
2964 const int NumParagraphs = 37;
2965 qsizetype commonPrefixLen = commonPrefix.size();
2968
2969
2970
2971
2972
2974 QString paragraphName[NumParagraphs + 1];
2975 QSet<
char> usedParagraphNames;
2977 for (
auto c = nmm.constBegin(); c != nmm.constEnd(); ++c) {
2978 QStringList pieces = c.key().split(
"::");
2979 int idx = commonPrefixLen;
2980 if (idx > 0 && !pieces.last().startsWith(commonPrefix, Qt::CaseInsensitive))
2982 QString last = pieces.last().toLower();
2983 QString key = last.mid(idx);
2985 int paragraphNr = NumParagraphs - 1;
2987 if (key[0].digitValue() != -1) {
2988 paragraphNr = key[0].digitValue();
2989 }
else if (key[0] >= QLatin1Char(
'a') && key[0] <= QLatin1Char(
'z')) {
2990 paragraphNr = 10 + key[0].unicode() -
'a';
2993 paragraphName[paragraphNr] = key[0].toUpper();
2994 usedParagraphNames.insert(key[0].toLower().cell());
2995 paragraph[paragraphNr].insert(last, c.value());
2999
3000
3001
3002
3003
3004
3005
3006 qsizetype paragraphOffset[NumParagraphs + 1];
3007 paragraphOffset[0] = 0;
3008 for (
int i = 0; i < NumParagraphs; i++)
3009 paragraphOffset[i + 1] = paragraphOffset[i] + paragraph[i].size();
3012
3013
3014 if (includeAlphabet) {
3015 out() <<
"<p class=\"centerAlign functionIndex\" translate=\"no\"><b>";
3016 for (
int i = 0; i < 26; i++) {
3018 if (usedParagraphNames.contains(
char(
'a' + i)))
3019 out() << QString(
"<a href=\"#%1\">%2</a> ").arg(ch).arg(ch.toUpper());
3021 out() <<
"</b></p>\n";
3025
3026
3027 out() <<
"<div class=\"flowListDiv\" translate=\"no\">\n";
3031 QHash<QString,
int> nameOccurrences;
3032 for (
const auto &[key, node] : nmm.asKeyValueRange()) {
3033 QStringList pieces{node->fullName(relative).split(
"::"_L1)};
3034 const QString &name{pieces.last()};
3035 nameOccurrences[name]++;
3039 int curParOffset = 0;
3041 for (
int i = 0; i < nmm.size(); i++) {
3042 while ((curParNr < NumParagraphs) && (curParOffset == paragraph[curParNr].size())) {
3048
3049
3050 if (curParOffset == 0) {
3053 if (++m_numTableRows % 2 == 1)
3054 out() <<
"<dl class=\"flowList odd\">";
3056 out() <<
"<dl class=\"flowList even\">";
3057 out() <<
"<dt class=\"alphaChar\"";
3058 if (includeAlphabet)
3059 out() << QString(
" id=\"%1\"").arg(paragraphName[curParNr][0].toLower());
3060 out() <<
"><b>" << paragraphName[curParNr] <<
"</b></dt>\n";
3064
3065
3067 if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) {
3068 NodeMultiMap::Iterator it;
3069 NodeMultiMap::Iterator next;
3070 it = paragraph[curParNr].begin();
3071 for (
int j = 0; j < curParOffset; j++)
3076
3077
3078
3079 out() <<
"<a href=\"" << linkForNode(it.value(), relative) <<
"\">";
3081 QString fileName = fileBase(it.value()) +
"-obsolete." + fileExtension();
3084 link =
"../%1/"_L1.arg(it.value()->tree()->physicalModuleName());
3086 out() <<
"<a href=\"" << link <<
"\">";
3089 QStringList pieces{it.value()->fullName(relative).split(
"::"_L1)};
3090 const auto &name{pieces.last()};
3093 if (nameOccurrences[name] > 1) {
3094 const QString moduleName = it.value()->isQmlNode() ? it.value()->logicalModuleName()
3095 : it.value()->tree()->camelCaseModuleName();
3096 pieces.last().append(
": %1"_L1.arg(moduleName));
3099 out() << protectEnc(pieces.last());
3101 if (pieces.size() > 1) {
3103 generateFullName(it.value()->parent(), relative);
3113 out() <<
"</div>\n";
3118 out() <<
"<p class=\"centerAlign functionIndex\" translate=\"no\"><b>";
3119 for (
int i = 0; i < 26; i++) {
3121 out() << QString(
"<a href=\"#%1\">%2</a> ").arg(ch).arg(ch.toUpper());
3123 out() <<
"</b></p>\n";
3125 char nextLetter =
'a';
3127 out() <<
"<ul translate=\"no\">\n";
3128 NodeMapMap &funcIndex = m_qdb->getFunctionIndex();
3129 for (
auto fnMap = funcIndex.constBegin(); fnMap != funcIndex.constEnd(); ++fnMap) {
3130 const QString &key = fnMap.key();
3131 const QChar firstLetter = key.isEmpty() ? QChar(
'A') : key.front();
3132 Q_ASSERT_X(firstLetter.unicode() < 256,
"generateFunctionIndex",
3133 "Only valid C++ identifiers were expected");
3134 const char currentLetter = firstLetter.isLower() ? firstLetter.unicode() : nextLetter - 1;
3136 if (currentLetter < nextLetter) {
3140 while (nextLetter < currentLetter)
3141 out() << QStringLiteral(
"<li id=\"%1\"></li>").arg(nextLetter++);
3142 Q_ASSERT(nextLetter == currentLetter);
3143 out() << QStringLiteral(
"<li id=\"%1\">").arg(nextLetter++);
3145 out() << protectEnc(key) <<
':';
3147 for (
auto it = (*fnMap).constBegin(); it != (*fnMap).constEnd(); ++it) {
3149 generateFullName((*it)->parent(), relative, *it);
3153 while (nextLetter <=
'z')
3154 out() << QStringLiteral(
"<li id=\"%1\"></li>").arg(nextLetter++);
3161 for (
auto it = legaleseTexts.cbegin(), end = legaleseTexts.cend(); it != end; ++it) {
3162 Text text = it.key();
3163 generateText(text, relative, marker);
3167 generateFullName(it.value(), relative);
3170 }
while (it != legaleseTexts.constEnd() && it.key() == text);
3178 QString marked = marker->markedUpQmlItem(node, summary);
3179 marked.replace(
"@param>",
"i>");
3181 marked.replace(
"<@extra>",
"<code class=\"%1 extra\" translate=\"no\">"_L1
3182 .arg(summary ?
"summary"_L1 :
"details"_L1));
3183 marked.replace(
"</@extra>",
"</code>");
3187 marked.remove(
"<@name>");
3188 marked.remove(
"</@name>");
3189 marked.remove(
"<@type>");
3190 marked.remove(
"</@type>");
3192 out() << highlightedCode(marked, relative,
false, Genus::QML);
3196
3197
3198
3199
3200
3201
3202
3205 m_qdb->mergeCollections(cn);
3210 if (sortOrder == Qt::DescendingOrder)
3215 for (
const auto *node : std::as_const(members)) {
3216 out() <<
"<li translate=\"no\">";
3217 generateFullName(node,
nullptr);
3225 const QString &selector, Qt::SortOrder sortOrder)
3229 if (selector == QLatin1String(
"overviews"))
3231 else if (selector == QLatin1String(
"cpp-modules"))
3233 else if (selector == QLatin1String(
"qml-modules"))
3237 m_qdb->mergeCollections(type, cnm, relative);
3238 const auto collectionList = cnm.values();
3239 nodeList.reserve(collectionList.size());
3240 for (
auto *collectionNode : collectionList)
3241 nodeList.append(collectionNode);
3242 generateAnnotatedList(relative, marker, nodeList, sortOrder);
3245
3246
3247
3248
3251 QStringLiteral(
"\\generatelist {%1} is only allowed in \\group, "
3252 "\\module and \\qmlmodule comments.")
3256 auto *node =
const_cast<
Node *>(relative);
3257 auto *collectionNode =
static_cast<CollectionNode *>(node);
3258 if (!collectionNode)
3260 m_qdb->mergeCollections(collectionNode);
3261 generateAnnotatedList(collectionNode, marker, collectionNode->members(), sortOrder);
3267 bool alignNames =
true;
3268 if (!nv.isEmpty()) {
3269 bool twoColumn =
false;
3270 if (nv.first()->isProperty()) {
3271 twoColumn = (nv.size() >= 5);
3275 out() <<
"<div class=\"table\"><table class=\"alignedsummary\" translate=\"no\">\n";
3278 out() <<
"<div class=\"table\"><table class=\"propsummary\" translate=\"no\">\n"
3279 <<
"<tr><td class=\"topAlign\">";
3284 for (
const auto &member : nv) {
3286 if (member->isSharedCommentNode() && !member->isPropertyGroup())
3290 out() <<
"<tr><td class=\"memItemLeft rightAlign topAlign\"> ";
3292 if (twoColumn && i == (nv.size() + 1) / 2)
3293 out() <<
"</ul></td><td class=\"topAlign\"><ul>\n";
3294 out() <<
"<li class=\"fn\" translate=\"no\">";
3297 generateSynopsis(member, relative, marker, Section::Summary, alignNames);
3299 out() <<
"</td></tr>\n";
3305 out() <<
"</table></div>\n";
3309 out() <<
"</td></tr>\n</table></div>\n";
3317 bool alignNames =
true;
3320 if (!members.isEmpty()) {
3321 bool hasPrivateSignals =
false;
3322 bool isInvokable =
false;
3323 bool twoColumn =
false;
3326 twoColumn = (members.size() >= 16);
3327 }
else if (members.first()->isProperty()) {
3328 twoColumn = (members.size() >= 5);
3332 out() <<
"<div class=\"table\"><table class=\"alignedsummary\" translate=\"no\">\n";
3335 out() <<
"<div class=\"table\"><table class=\"propsummary\" translate=\"no\">\n"
3336 <<
"<tr><td class=\"topAlign\">";
3341 for (
const auto &member : members) {
3344 if (member->name().isEmpty())
3348 out() <<
"<tr><td class=\"memItemLeft topAlign rightAlign\"> ";
3350 if (twoColumn && i == (members.size() + 1) / 2)
3351 out() <<
"</ul></td><td class=\"topAlign\"><ul>\n";
3352 out() <<
"<li class=\"fn\" translate=\"no\">";
3355 generateSynopsis(member, relative, marker, section.style(), alignNames);
3356 if (member->isFunction()) {
3357 const auto *fn =
static_cast<
const FunctionNode *>(member);
3358 if (fn->isPrivateSignal()) {
3359 hasPrivateSignals =
true;
3361 out() <<
"</td><td class=\"memItemRight bottomAlign\">[see note below]";
3362 }
else if (fn->isInvokable()) {
3365 out() <<
"</td><td class=\"memItemRight bottomAlign\">[see note below]";
3369 out() <<
"</td></tr>\n";
3375 out() <<
"</table></div>\n";
3379 out() <<
"</td></tr>\n</table></div>\n";
3382 if (hasPrivateSignals)
3390 && !section.inheritedMembers().isEmpty()) {
3392 generateSectionInheritedList(section, relative);
3399 const QList<std::pair<
const Aggregate *,
int>> &inheritedMembers = section.inheritedMembers();
3400 for (
const auto &member : inheritedMembers) {
3401 out() <<
"<li class=\"fn\" translate=\"no\">";
3402 out() << member.second <<
' ';
3403 if (member.second == 1) {
3404 out() << section.singular();
3406 out() << section.plural();
3408 out() <<
" inherited from <a href=\"" << fileName(member.first) <<
'#'
3409 << Generator::cleanRef(section.title().toLower()) <<
"\">"
3410 << protectEnc(member.first->plainFullName(relative)) <<
"</a></li>\n";
3417 QString marked = marker->markedUpSynopsis(node, relative, style);
3418 marked.replace(
"@param>",
"i>");
3421 marked.remove(
"<@name>");
3422 marked.remove(
"</@name>");
3426 static const QRegularExpression extraRegExp(
"<@extra>.*</@extra>",
3427 QRegularExpression::InvertedGreedinessOption);
3428 marked.remove(extraRegExp);
3430 marked.replace(
"<@extra>",
"<code class=\"%1 extra\" translate=\"no\">"_L1
3431 .arg(style == Section::Summary ?
"summary"_L1 :
"details"_L1));
3432 marked.replace(
"</@extra>",
"</code>");
3436 marked.remove(
"<@type>");
3437 marked.remove(
"</@type>");
3440 out() << highlightedCode(marked, relative, alignNames);
3443QString
HtmlGenerator::highlightedCode(
const QString &markedCode,
const Node *relative,
3444 bool alignNames, Genus genus)
3446 QString src = markedCode;
3448 html.reserve(src.size());
3452 const QChar charLangle =
'<';
3453 const QChar charAt =
'@';
3455 static const QString typeTag(
"type");
3456 static const QString headerTag(
"headerfile");
3457 static const QString funcTag(
"func");
3458 static const QString linkTag(
"link");
3459 static const QString extrefTag(
"extref");
3460 static const QString conceptTag(
"concept");
3463 static const QHash<QString, QString> extrefUrls = {
3464 {
"cpp-explicitly-defaulted"_L1,
3465 "https://en.cppreference.com/w/cpp/language/function#Defaulted_functions"_L1},
3466 {
"cpp-deleted-functions"_L1,
3467 "https://en.cppreference.com/w/cpp/language/function#Deleted_functions"_L1},
3474 for (
int i = 0, srcSize = src.size(); i < srcSize;) {
3475 if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
3476 if (alignNames && !done) {
3477 html += QLatin1String(
"</td><td class=\"memItemRight bottomAlign\">");
3481 if (parseArg(src, linkTag, &i, srcSize, &arg, &par1)) {
3482 html += QLatin1String(
"<b>");
3483 const Node *n =
static_cast<
const Node*>(
Utilities::nodeForString(par1.toString()));
3484 QString link = linkForNode(n, relative);
3485 addLink(link, arg, &html);
3486 html += QLatin1String(
"</b>");
3487 }
else if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
3488 const FunctionNode *fn = m_qdb->findFunctionNode(par1.toString(), relative, genus);
3489 QString link = linkForNode(fn, relative);
3490 addLink(link, arg, &html);
3491 par1 = QStringView();
3492 }
else if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
3493 par1 = QStringView();
3494 const Node *n = m_qdb->findTypeNode(arg.toString(), relative, genus);
3495 html += QLatin1String(
"<span class=\"type\">");
3498 addLink(linkForNode(n, relative), arg, &html);
3502 addLink(linkForNode(n, relative), arg, &html);
3503 html += QLatin1String(
"</span>");
3504 }
else if (parseArg(src, conceptTag, &i, srcSize, &arg, &par1)) {
3508 const QString target = par1.isEmpty() ? arg.toString() : par1.toString();
3509 par1 = QStringView();
3510 const Node *n = m_qdb->findConceptNode(target);
3512 addLink(linkForNode(n, relative), arg, &html);
3515 }
else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
3516 par1 = QStringView();
3517 if (arg.startsWith(QLatin1Char(
'&')))
3520 const Node *n = m_qdb->findNodeForInclude(QStringList(arg.toString()));
3521 if (n && n != relative)
3522 addLink(linkForNode(n, relative), arg, &html);
3526 }
else if (parseArg(src, extrefTag, &i, srcSize, &arg, &par1)) {
3527 QString url = extrefUrls.value(par1.toString());
3529 addLink(url, arg, &html);
3537 html += src.at(i++);
3546 html.reserve(src.size());
3549 QLatin1StringView tag;
3550 QLatin1StringView span;
3552 static constexpr SpanTag spanTags[] = {
3553 {
"comment>"_L1,
"<span class=\"comment\">"_L1},
3554 {
"preprocessor>"_L1,
"<span class=\"preprocessor\">"_L1},
3555 {
"string>"_L1,
"<span class=\"string\">"_L1},
3556 {
"char>"_L1,
"<span class=\"char\">"_L1},
3557 {
"number>"_L1,
"<span class=\"number\">"_L1},
3558 {
"op>"_L1,
"<span class=\"operator\">"_L1},
3559 {
"type>"_L1,
"<span class=\"type\">"_L1},
3560 {
"name>"_L1,
"<span class=\"name\">"_L1},
3561 {
"keyword>"_L1,
"<span class=\"keyword\">"_L1},
3562 {
"template-block>"_L1,
"<span class=\"template-block\">"_L1},
3566 const qsizetype n = src.size();
3567 const QStringView sv(src);
3569 if (sv.at(i) ==
'<'_L1) {
3570 if (i + 1 < n && sv.at(i + 1) ==
'@'_L1) {
3572 bool handled =
false;
3573 for (
const auto &st : spanTags) {
3574 if (i + st.tag.size() <= n
3575 && st.tag == sv.sliced(i, st.tag.size())) {
3584 while (i < n && sv.at(i) !=
'>'_L1)
3590 }
else if (i + 2 < n && sv.at(i + 1) ==
'/'_L1 && sv.at(i + 2) ==
'@'_L1) {
3592 bool handled =
false;
3593 for (
const auto &st : spanTags) {
3594 if (i + st.tag.size() <= n
3595 && st.tag == sv.sliced(i, st.tag.size())) {
3596 html +=
"</span>"_L1;
3604 while (i < n && sv.at(i) !=
'>'_L1)
3622 if (m_linkNode && m_linkNode->isFunction()) {
3624 if (match.hasMatch()) {
3626 qsizetype leftParenLoc = match.capturedStart(1);
3627 out() << protectEnc(atom->string().left(leftParenLoc));
3629 out() << protectEnc(atom->string().mid(leftParenLoc));
3633 out() << protectEnc(atom->string());
3638 return protect(string);
3643 if (string.isEmpty())
3647 if (html.isEmpty()) {
3654 qsizetype n = string.size();
3656 for (
int i = 0; i < n; ++i) {
3657 QChar ch = string.at(i);
3659 if (ch == QLatin1Char(
'&')) {
3661 }
else if (ch == QLatin1Char(
'<')) {
3663 }
else if (ch == QLatin1Char(
'>')) {
3665 }
else if (ch == QChar(8211)) {
3667 }
else if (ch == QChar(8212)) {
3669 }
else if (ch == QLatin1Char(
'"')) {
3672 if (!html.isEmpty())
3677 if (!html.isEmpty())
3686 QString result = Generator::fileBase(node);
3688 result += QLatin1String(
"-obsolete");
3695 return node->name();
3696 return Generator::fileName(node);
3700 const Node *actualNode)
3702 if (actualNode ==
nullptr)
3703 actualNode = apparentNode;
3704 bool link = !linkForNode(actualNode, relative).isEmpty();
3706 out() <<
"<a href=\"" << linkForNode(actualNode, relative);
3708 out() <<
"\" class=\"obsolete";
3711 out() << protectEnc(apparentNode->fullName(relative));
3717
3718
3719
3726 const auto srcLink = Config::instance().getSourceLink();
3727 if (!srcLink.enabled)
3732 if (loc
.isEmpty() || srcLink.baseUrl.isEmpty() || srcLink.rootPath.isEmpty())
3735 QString srcUrl{srcLink.baseUrl};
3736 if (!srcUrl.contains(
'\1'_L1)) {
3737 if (!srcUrl.endsWith(
'/'_L1))
3742 QDir rootDir{srcLink.rootPath};
3743 srcUrl.replace(
'\1'_L1, rootDir.relativeFilePath(loc.filePath()));
3744 srcUrl.replace(
'\2'_L1, QString::number(loc.lineNo()));
3745 const auto &description{
"View declaration of this %1"_L1.arg(node->nodeTypeString())};
3746 out() <<
"<a class=\"srclink\" href=\"%1\" title=\"%2\">%3</a>"_L1
3747 .arg(srcUrl, description, srcLink.linkText);
3754 const QString base = refForNode(node);
3756 for (
int n = 2; m_emittedMemberRefs.contains(ref); ++n)
3757 ref = base +
'-'_L1 + QString::number(n);
3758 m_emittedMemberRefs.insert(ref);
3766 generateExtractionMark(node, MemberMark);
3769 const QList<Node *> &collective = scn->collective();
3770 if (collective.size() > 1)
3771 out() <<
"<div class=\"fngroup\">\n";
3772 QSet<
const Node *> emitted;
3773 for (
const auto *sharedNode : collective) {
3774 if (emitted.contains(sharedNode))
3776 emitted.insert(sharedNode);
3777 out() << headingStart.arg(getClassAttr(sharedNode,
"fn fngroupitem"_L1),
3778 memberHeadingRef(sharedNode));
3779 generateSynopsis(sharedNode, relative, marker, Section::Details);
3780 generateSourceLink(sharedNode);
3781 out() << headingEnd;
3783 if (collective.size() > 1)
3787 if (node->isEnumType(Genus::CPP) && (etn =
static_cast<
const EnumNode *>(node))->flagsType()) {
3788 out() << headingStart.arg(getClassAttr(node,
"flags"_L1), memberHeadingRef(node));
3792 generateSourceLink(node);
3793 out() << headingEnd;
3795 out() << headingStart.arg(getClassAttr(node,
"fn"_L1), memberHeadingRef(node));
3797 generateSourceLink(node);
3798 out() << headingEnd;
3805 const auto *func =
static_cast<
const FunctionNode *>(node);
3806 if (func->hasOverloads() && (func->isSignal() || func->isSlot()))
3815 const auto property =
static_cast<
const PropertyNode *>(node);
3825 out() <<
"<p><b>Access functions:</b></p>\n";
3826 generateSectionList(section, node, marker);
3833 out() <<
"<p><b>Notifier signal:</b></p>\n";
3834 generateSectionList(notifiers, node, marker);
3838 const auto *enumTypeNode =
static_cast<
const EnumNode *>(node);
3839 if (enumTypeNode->flagsType()) {
3840 out() <<
"<p>The " << protectEnc(enumTypeNode->flagsType()->name())
3841 <<
" type is a typedef for "
3842 <<
"<a href=\"" << m_qflagsHref <<
"\">QFlags</a><"
3843 << protectEnc(enumTypeNode->name()) <<
">. It stores an OR combination of "
3844 << protectEnc(enumTypeNode->name()) <<
" values.</p>\n";
3847 generateAlsoList(node, marker);
3848 generateExtractionMark(node, EndMark);
3852
3853
3854
3855
3860 m_linkNode =
nullptr;
3862 if (!m_link.isEmpty())
3863 out() <<
"<a href=\"" << m_link <<
"\" translate=\"no\">";
3871 if (m_link.isEmpty())
3874 const QString &translate_attr =
3875 (node && isApiGenus(node->genus())) ?
" translate=\"no\""_L1 :
""_L1;
3877 if (node ==
nullptr || (relative !=
nullptr && node->status() == relative->status()))
3878 out() <<
"<a href=\"" << m_link <<
"\"%1>"_L1.arg(translate_attr);
3879 else if (node->isDeprecated())
3880 out() <<
"<a href=\"" << m_link <<
"\" class=\"obsolete\"%1>"_L1.arg(translate_attr);
3882 out() <<
"<a href=\"" << m_link <<
"\"%1>"_L1.arg(translate_attr);
3891 m_linkNode =
nullptr;
3893 if (!m_link.isEmpty())
3898
3899
3900
3904 if (!members.isEmpty()) {
3906 for (
const auto &member : members) {
3907 out() <<
"<li class=\"fn\" translate=\"no\">";
3908 generateQmlItem(member, relative, marker,
true);
3909 if (member->isPropertyGroup()) {
3910 const auto *scn =
static_cast<
const SharedCommentNode *>(member);
3911 if (scn->count() > 0) {
3913 const QList<Node *> &sharedNodes = scn->collective();
3914 for (
const auto &node : sharedNodes) {
3915 if (node->isQmlProperty()) {
3916 out() <<
"<li class=\"fn\" translate=\"no\">";
3917 generateQmlItem(node, relative, marker,
true);
3931
3932
3935 out() << headingStart.arg(getClassAttr(scn,
"fn qml-member qml-property-group"_L1),
3937 <<
"<b>" << scn->name() <<
" group</b>"
3942
3943
3944
3948 generateExtractionMark(node, MemberMark);
3950 auto generateQmlProperty = [&](
Node *n,
bool isGroupItem =
false) {
3951 const auto cssClasses = isGroupItem ?
"fn qml-member qml-property fngroupitem"_L1 :
"fn qml-member qml-property"_L1;
3952 out() << headingStart.arg(getClassAttr(n, cssClasses), refForNode(n));
3953 generateQmlItem(n, relative, marker,
false);
3954 generateSourceLink(n);
3955 out() << headingEnd;
3958 auto generateQmlMethod = [&](
Node *n,
bool isGroupItem =
false) {
3959 const auto cssClasses = isGroupItem ?
"fn qml-member qml-method fngroupitem"_L1 :
"fn qml-member qml-method"_L1;
3960 out() << headingStart.arg(getClassAttr(n, cssClasses), refForNode(n));
3962 generateSourceLink(n);
3963 out() << headingEnd;
3967 auto *scn =
static_cast<
const SharedCommentNode *>(node);
3968 const auto shared = scn->collective();
3970 if (scn->isPropertyGroup() && !scn->name().isEmpty())
3971 emitGroupHeader(scn);
3973 const bool isGroup = shared.size() > 1;
3976 out() <<
"<div class=\"fngroup\">\n"_L1;
3978 for (
auto *child : std::as_const(shared)) {
3979 if (child->isQmlProperty())
3980 generateQmlProperty(child, isGroup);
3982 generateQmlMethod(child, isGroup);
3986 out() <<
"</div>"_L1;
3989 generateQmlProperty(node);
3991 generateQmlMethod(node);
3998 generateAlsoList(node, marker);
3999 generateExtractionMark(node, EndMark);
4002void HtmlGenerator::generateExtractionMark(
const Node *node, ExtractionMarkType markType)
4004 if (markType != EndMark) {
4005 out() <<
"<!-- $$$" + node->name();
4006 if (markType == MemberMark) {
4008 const auto *func =
static_cast<
const FunctionNode *>(node);
4009 if (!func->hasAssociatedProperties()) {
4010 if (func->overloadNumber() == 0)
4011 out() <<
"[overload1]";
4012 out() <<
"$$$" + func->name() + func->parameters().rawSignature().remove(
' ');
4016 const auto *prop =
static_cast<
const PropertyNode *>(node);
4017 const NodeList &list = prop->functions();
4018 for (
const auto *propFuncNode : list) {
4019 if (propFuncNode->isFunction()) {
4020 const auto *func =
static_cast<
const FunctionNode *>(propFuncNode);
4021 out() <<
"$$$" + func->name()
4022 + func->parameters().rawSignature().remove(
' ');
4026 const auto *enumNode =
static_cast<
const EnumNode *>(node);
4027 const auto &items = enumNode->items();
4028 for (
const auto &item : items)
4029 out() <<
"$$$" + item.name();
4031 }
else if (markType == BriefMark) {
4033 }
else if (markType == DetailedDescriptionMark) {
4034 out() <<
"-description";
4038 out() <<
"<!-- @@@" + node->name() +
" -->\n";
#define ATOM_FORMATTING_TELETYPE
#define ATOM_LIST_LOWERALPHA
#define ATOM_FORMATTING_UNDERLINE
#define ATOM_LIST_UPPERALPHA
#define ATOM_FORMATTING_NOTRANSLATE
#define ATOM_LIST_LOWERROMAN
#define ATOM_FORMATTING_SPAN
#define ATOM_FORMATTING_SUBSCRIPT
#define ATOM_FORMATTING_BOLD
#define ATOM_FORMATTING_TRADEMARK
#define ATOM_FORMATTING_ITALIC
#define ATOM_LIST_UPPERROMAN
#define ATOM_FORMATTING_LINK
#define ATOM_FORMATTING_SUPERSCRIPT
#define ATOM_FORMATTING_INDEX
#define ATOM_FORMATTING_UICONTROL
#define ATOM_FORMATTING_PARAMETER
The Atom class is the fundamental unit for representing documents internally.
AtomType type() const
Return the type of this atom.
AtomType
\value AnnotatedList \value AutoLink \value BaseName \value BriefLeft \value BriefRight \value C \val...
const Atom * next() const
Return the next atom in the atom list.
const Atom * next(AtomType t) const
Return the next Atom in the list if it is of AtomType t.
The ClassNode represents a C++ class.
virtual Atom::AtomType atomType() const
A class for holding the members of a collection of doc pages.
const NodeList & members() const
bool wasSeen() const override
Returns the seen flag data member of this node if it is a NamespaceNode or a CollectionNode.
NodeMap getMembers(NodeType type) const
const Location & location() const
Returns the starting location of a qdoc comment.
bool hasTableOfContents() const
static void quoteFromFile(const Location &location, Quoter "er, ResolvedFile resolved_file, CodeMarker *marker=nullptr)
Text briefText(bool inclusive=false) const
QStringMultiMap * metaTagMap() const
const TypedefNode * flagsType() const
Encapsulate the logic that QDoc uses to find files whose path is provided by the user and that are re...
This node is used to represent any kind of function being documented.
bool generateComparisonCategory(const Node *node, CodeMarker *marker=nullptr)
static void setQmlTypeContext(QmlTypeNode *t)
void generateStatus(const Node *node, CodeMarker *marker)
void generateThreadSafeness(const Node *node, CodeMarker *marker)
Generates text that explains how threadsafe and/or reentrant node is.
static bool useOutputSubdirs()
static bool noLinkErrors()
void generateNoexceptNote(const Node *node, CodeMarker *marker)
void unknownAtom(const Atom *atom)
virtual void terminateGenerator()
static bool matchAhead(const Atom *atom, Atom::AtomType expectedAtomType)
virtual void generateDocs()
Traverses the database recursively to generate all the documentation.
static bool appendTrademark(const Atom *atom)
Returns true if a trademark symbol should be appended to the output as determined by atom.
static bool s_redirectDocumentationToDevNull
virtual void generateBody(const Node *node, CodeMarker *marker)
Generate the body of the documentation from the qdoc comment found with the entity represented by the...
void generateSince(const Node *node, CodeMarker *marker)
void endSubPage()
Flush the text stream associated with the subpage, and then pop it off the text stream stack and dele...
static bool autolinkErrors()
bool generateComparisonTable(const Node *node)
Generates a table of comparison categories for node, combining both self-comparison (from \compares) ...
virtual void initializeGenerator()
No-op base implementation.
QString fileExtension() const override
Returns "html" for this subclass of Generator.
void generateProxyPage(Aggregate *aggregate, CodeMarker *marker) override
void generatePageNode(PageNode *pn, CodeMarker *marker) override
Generate the HTML page for an entity that doesn't map to any underlying parsable C++ or QML element.
void generateCppReferencePage(Aggregate *aggregate, CodeMarker *marker) override
Generate a reference page for the C++ class, namespace, or header file documented in node using the c...
void generateDocs() override
If qdoc is in the {-prepare} phase, traverse the primary tree to generate the index file for the curr...
void generateCollectionNode(CollectionNode *cn, CodeMarker *marker) override
Generate the HTML page for a group, module, or QML module.
~HtmlGenerator() override
Destroys the HTML output generator.
HtmlGenerator(FileResolver &file_resolver)
void generateExampleFilePage(const PageNode *en, ResolvedFile resolved_file, CodeMarker *marker) override
Generate an html file with the contents of a C++ or QML source file.
QString fileBase(const Node *node) const override
void generateGenericCollectionPage(CollectionNode *cn, CodeMarker *marker) override
Generate the HTML page for a generic collection.
void generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker) override
Generate the HTML page for a QML type.
void initializeGenerator() override
Initializes the HTML output generator's data structures from the configuration (Config) singleton.
QString format() const override
Returns the format identifier for this producer (e.g., "HTML", "DocBook", "template").
void terminateGenerator() override
Gracefully terminates the HTML output generator.
virtual bool generatesHelpProject() const
Returns true if this generator writes a Qt help project (.qhp) file.
qsizetype generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) override
Generate html from an instance of Atom.
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
The Location class provides a way to mark a location in a file.
bool isEmpty() const
Returns true if there is no file name set yet; returns false otherwise.
The ManifestWriter is responsible for writing manifest files.
void generateManifestFiles()
This function outputs one or more manifest files in XML.
This class represents a C++ namespace.
NamespaceNode * docNode() const
Returns a pointer to the NamespaceNode that represents where the namespace documentation is actually ...
Tree * tree() const override
Returns a pointer to the Tree that contains this NamespaceNode.
bool isDocumentedHere() const
Returns true if this namespace is to be documented in the current module.
A PageNode is a Node that generates a documentation page.
bool noAutoList() const
Returns the value of the no auto-list flag.
This class describes one instance of using the Q_PROPERTY macro.
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static QDocDatabase * qdocDB()
Creates the singleton.
Status
Specifies the status of the QQmlIncubator.
ClassNode * classNode() const override
If this is a QmlTypeNode, this function returns the pointer to the C++ ClassNode that this QML type r...
bool isUncreatable() const
static void subclasses(const Node *base, NodeList &subs, bool recurse=false)
Loads the list subs with the nodes of all the subclasses of base.
QString logicalModuleVersion() const override
If the QML type's QML module pointer is set, return the QML module version from the QML module node.
QString logicalModuleName() const override
If the QML type's QML module pointer is set, return the QML module name from the QML module node.
QmlTypeNode * qmlBaseNode() const override
If this Aggregate is a QmlTypeNode, this function returns a pointer to the QmlTypeNode that is its ba...
CollectionNode * logicalModule() const override
If this is a QmlTypeNode, a pointer to its QML module is returned, which is a pointer to a Collection...
A class for containing the elements of one documentation section.
const NodeVector & obsoleteMembers() const
void appendMembers(const NodeVector &nv)
const Aggregate * aggregate() const
const ClassNodesList & classNodesList() const
const NodeVector & members() const
A class for creating vectors of collections for documentation.
const Aggregate * aggregate() const
SectionVector & summarySections()
SectionVector & sinceSections()
Sections(const Aggregate *aggregate)
This constructor builds the section vectors based on the type of the aggregate node.
Sections(const NodeMultiMap &nsmap)
This constructor builds the since sections from the since node map, nsmap.
bool hasObsoleteMembers(SectionPtrVector *summary_spv, SectionPtrVector *details_spv) const
Returns true if any sections in this object contain obsolete members.
SectionVector & detailsSections()
const Section & allMembersSection() const
Table of contents writer.
void generateTOC(const QString &fileName, const QString &indexTitle)
Writes the TOC entries for project to fileName, starting from a page with a title matching indexTitle...
This class handles the generation of the QDoc tag files.
void generateTagFile(const QString &fileName, Generator *generator)
Writes a tag file named fileName.
const QString & camelCaseModuleName() const
static void rewritePropertyBrief(const Atom *atom, const Node *relative)
Rewrites the brief of this node depending on its first word.
static int hOffset(const Node *node)
Header offset depending on the type of the node.
static bool hasBrief(const Node *node)
Do not display.
XmlGenerator(FileResolver &file_resolver)
static const QRegularExpression m_funcLeftParen
static NodeType typeFromString(const Atom *atom)
Returns the type of this atom as an enumeration.
#define COMMAND_INQMLMODULE
#define CONFIG_USEALTTEXTASTITLE
#define CONFIG_CPPCLASSESTITLE
#define CONFIG_CODEPREFIX
#define CONFIG_QMLTYPESPAGE
#define CONFIG_HEADERSCRIPTS
#define CONFIG_DESCRIPTION
#define CONFIG_CODEINDENT
#define CONFIG_TRADEMARKSPAGE
#define CONFIG_CPPCLASSESPAGE
#define CONFIG_NATURALLANGUAGE
#define CONFIG_PRODUCTNAME
#define CONFIG_NAVIGATION
#define CONFIG_BUILDVERSION
#define CONFIG_LANDINGPAGE
#define CONFIG_CODESUFFIX
#define CONFIG_LANDINGTITLE
#define CONFIG_HEADERSTYLES
#define CONFIG_QMLTYPESTITLE
static QString getClassAttr(const Node *node, const QString &classSet)
Extends the class HTML attribute generated for node.
static void appendTemplateParametersAtoms(Text &out, const TemplateDeclarationStorage &storage)
static const Atom closeCodeTag
static void addLink(const QString &linkTarget, QStringView nestedStuff, QString *res)
static const auto headingStart
static void appendTemplateParameterAtoms(Text &out, const RelaxedTemplateParameter ¶m)
static const auto headingEnd
static const Atom openCodeTag
static void appendTemplateDeclAtoms(Text &out, const RelaxedTemplateDeclaration &templateDecl)
#define HTMLGENERATOR_PROLOGUE
#define HTMLGENERATOR_NONAVIGATIONBAR
#define HTMLGENERATOR_TOCDEPTH
#define HTMLGENERATOR_NAVIGATIONSEPARATOR
#define HTMLGENERATOR_POSTPOSTHEADER
#define HTMLGENERATOR_ADDRESS
#define HTMLGENERATOR_FOOTER
#define HTMLGENERATOR_POSTHEADER
Pure string helpers with no dependencies on QDoc driver types.
This namespace holds QDoc-internal utility methods.
QList< Node * > NodeVector
QMap< QString, Node * > NodeMap
QMap< QString, NodeMap > NodeMapMap
QMap< QString, CollectionNode * > CNMap
QT_BEGIN_NAMESPACE typedef QMultiMap< Text, const Node * > TextToNodeMap
QList< const Section * > SectionPtrVector
QList< Section > SectionVector
QList< ClassNodes > ClassNodesList
The Node class is the base class for all the nodes in QDoc's parse tree.
bool isExternalPage() const
Returns true if the node type is ExternalPage.
const Doc & doc() const
Returns a reference to the node's Doc data member.
virtual bool hasClasses() const
Returns true if this is a CollectionNode and its members list contains class nodes.
virtual bool hasNamespaces() const
Returns true if this is a CollectionNode and its members list contains namespace nodes.
bool isEnumType(Genus g) const
bool isGroup() const
Returns true if the node type is Group.
SharedCommentNode * sharedCommentNode()
bool isNamespace() const
Returns true if the node type is Namespace.
bool isQmlBasicType() const
Returns true if the node type is QmlBasicType.
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
bool isSharedCommentNode() const
Returns true if the node type is SharedComment.
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
bool isHeader() const
Returns true if the node type is HeaderFile.
Genus genus() const override
Returns this node's Genus.
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
bool isEnumType() const
Returns true if the node type is Enum.
virtual Status status() const
Returns the node's status value.
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Aggregate * parent() const
Returns the node's parent pointer, that is, the aggregate under which the node is documented.
virtual bool isDeprecated() const
Returns true if this node's status is Deprecated.
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
bool isProxyNode() const
Returns true if the node type is Proxy.
const std::optional< RelaxedTemplateDeclaration > & templateDecl() const
bool isFunction(Genus g=Genus::DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
bool isProperty() const
Returns true if the node type is Property.
const Location & declLocation() const
Returns the Location where this node's declaration was seen.
NodeContext createContext() const
bool isModule() const
Returns true if the node type is Module.
bool isSharingComment() const
This function returns true if the node is sharing a comment with other nodes.
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
virtual bool isCollectionNode() const
Returns true if this is an instance of CollectionNode.
static bool nodeSortKeyOrNameLessThan(const Node *n1, const Node *n2)
Returns true if node n1 is less than node n2 when comparing the sort keys, defined with.
bool isQmlModule() const
Returns true if the node type is QmlModule.
bool isExample() const
Returns true if the node type is Example.
bool isQmlProperty() const
Returns true if the node type is QmlProperty.
ValuedDeclaration valued_declaration
@ NonTypeTemplateParameter
@ TemplateTemplateParameter
Represents a file that is reachable by QDoc based on its current configuration.