39#include <QtCore/qdebug.h>
40#include <QtCore/qdir.h>
41#include <QtCore/qregularexpression.h>
43#ifndef QT_BOOTSTRAPPED
44# include "QtCore/qurl.h"
50using namespace std::literals::string_literals;
54using namespace Qt::StringLiterals;
57QMap<QString, QMap<QString, QString>>
Generator::s_fmtLeftMaps;
58QMap<QString, QMap<QString, QString>>
Generator::s_fmtRightMaps;
59QList<Generator *>
Generator::s_generators;
64QList<
const PageNode *>
Generator::s_generatedPages;
65QStringList
Generator::s_exampleImageFileNames;
68QHash<QString, QString>
Generator::s_outputPrefixes;
69QHash<QString, QString>
Generator::s_outputSuffixes;
77static QRegularExpression
tag(
"</?@[^>]*>");
84
85
86
87
88
94 names.unite(p->templateDecl()->parameterNames());
100
101
102
103
104
105
107
111
112
113
115 const QSet<QString> &documentedNames,
116 const QSet<QString> &allowedNames,
119 for (
const auto &name : documentedNames) {
120 if (!allowedNames.contains(name) && CodeParser::isWorthWarningAbout(node->doc())) {
121 const auto message = (context == ValidationContext::TemplateDoc)
122 ?
"No such template parameter '%1' in %2"_L1
123 :
"No such parameter '%1' in %2"_L1;
124 node->doc().location().warning(message.arg(name, node->plainFullName()),
125 suggestName(name, allowedNames));
131
132
133
134
135
140 s_generators.prepend(
this);
144
145
146
149 s_generators.removeAll(
this);
153 const Node *actualNode)
155 if (actualNode ==
nullptr)
156 actualNode = apparentNode;
158 addNodeLink(text, actualNode, apparentNode->plainFullName(relative));
162 const Node *actualNode)
164 if (actualNode ==
nullptr)
165 actualNode = apparentNode;
167 addNodeLink(text, actualNode, fullName);
171
172
173
174
181
182
183
184
190 for (
const auto &node : nodes) {
191 text << Atom(Atom::ListItemNumber, QString::number(++count));
192 text << Atom(Atom::ListItemLeft, QString(
"bullet"));
193 appendSignature(text, node);
194 text << Atom(Atom::ListItemRight, QString(
"bullet"));
202 QMap<QString, Text> classMap;
203 for (
const auto &relatedClass : rc) {
204 ClassNode *rcn = relatedClass.m_node;
205 if (rcn && rcn->isInAPI()) {
207 appendFullName(className, rcn, cn);
208 classMap[className.toString().toLower()] = className;
213 const QStringList classNames = classMap.keys();
214 for (
const auto &className : classNames) {
215 text << classMap[className];
216 text << TextUtils::comma(index++, classNames.size());
224 QMap<QString, Text> classMap;
226 QStringList typeNames(knownTypes);
227 for (
const auto sub : subs)
228 typeNames << sub->name();
230 for (
const auto sub : subs) {
232 appendFullName(full_name, sub, base);
234 if (typeNames.count(sub->name()) > 1)
235 full_name << Atom(Atom::String,
" (%1)"_L1.arg(sub->logicalModuleName()));
236 classMap[full_name.toString().toLower()] = full_name;
240 const auto &names = classMap.keys();
241 for (
const auto &name : names)
242 text << classMap[name] << TextUtils::comma(index++, names.size());
247
248
249
250
251
252
253
254
255
256
264 if (s_outFileNames.contains(fileName) && !node
->isAttribution() && !fileName.contains(
"-attribution-"_L1))
265 node
->location().warning(
"Already generated %1 for this project"_L1.arg(fileName));
267 QString path = outputDir() + QLatin1Char(
'/') + fileName;
270 auto outFile =
new QFile(outPath);
273 const QString warningText {
"Output file already exists, overwriting %1"_L1.arg(outFile->fileName())};
274 if (qEnvironmentVariableIsSet(
"QDOC_ALL_OVERWRITES_ARE_WARNINGS"))
277 qCDebug(lcQdoc) << qUtf8Printable(warningText);
280 if (!outFile->open(QFile::WriteOnly | QFile::Text)) {
282 QStringLiteral(
"Cannot open output file '%1'").arg(outFile->fileName()));
285 qCDebug(lcQdoc,
"Writing: %s", qPrintable(path));
286 s_outFileNames << fileName;
291 if (fileName ==
this->fileName(node))
292 s_generatedPages << node;
293 s_trademarks.clear();
298
299
300
301
302
303
304
305
308 QFile *outFile = openSubPageFile(node, fileName);
309 auto *out =
new QTextStream(outFile);
310 outStreamStack.push(out);
314
315
316
317
320 outStreamStack.top()->flush();
321 delete outStreamStack.top()->device();
322 delete outStreamStack.pop();
331 return node->fileNameBase();
333 QString result = Utilities::computeFileBase(
335 [](
const Node *n) {
return outputPrefix(n); },
336 [](
const Node *n) {
return outputSuffix(n); });
338 const_cast<
Node *>(node)->setFileNameBase(result);
343
344
345
346
347
350 return Utilities::linkForExampleFile(path, s_project, fileExt.isEmpty() ? fileExtension() : fileExt);
354
355
356
359 return Utilities::exampleFileTitle(relative->files(), relative->images(), fileName);
363
364
365
366
367
370 if (!node->url().isEmpty())
377 QFileInfo originalName(node->name());
378 QString suffix = originalName.suffix();
379 if (!suffix.isEmpty() && suffix !=
"html") {
381 QString name = fileBase(node);
382 return name + QLatin1Char(
'.') + suffix;
386 QString name = fileBase(node) + QLatin1Char(
'.');
387 return name + (extension.isNull() ? fileExtension() : extension);
391
392
393
394
395
396
397
398
399QString
Generator::cleanRef(
const QString &ref,
bool xmlCompliant)
407 return s_fmtLeftMaps[format()];
412 return s_fmtRightMaps[format()];
416
417
418
419
420
421
425 node, [
this](
const Node *n) {
return fileBase(n); }, fileExtension());
429
430
431
432
433
434
435
438 QList<Text> alsoList = node
->doc().alsoList();
439 supplementAlsoList(node, alsoList);
441 if (!alsoList.isEmpty()) {
448 for (
const auto &also : std::as_const(alsoList)) {
450 const Atom *atom = also.firstAtom();
451 QString link = atom->string();
452 if (!used.contains(link)) {
457 if (m_qdb->findNodeForAtom(atom, node, ref) == node && ref.isEmpty())
458 node->doc().location().warning(
"Redundant link to self in \\sa command for %1"_L1.arg(node->name()));
463 for (
const auto &also : std::as_const(items))
464 text << also << TextUtils::separator(i++, items.size());
472 bool generate,
int &numAtoms)
474 while (atom !=
nullptr) {
476 int numAtoms0 = numAtoms;
477 bool rightFormat = canHandleFormat(atom->string());
492 if (generate && numAtoms0 == numAtoms) {
493 relative
->location().warning(QStringLiteral(
"Output format %1 not handled %2")
494 .arg(format(), outFileName()));
495 Atom unhandledFormatAtom(Atom::UnhandledFormat, format());
505 n += generateAtom(atom, relative, marker);
517
518
519
522 const FunctionNode *fn = node->isFunction() ?
static_cast<
const FunctionNode *>(node) :
nullptr;
525
526
527
531 text <<
"Destroys the instance of ";
532 text << fn
->parent()->name() <<
".";
534 text <<
" The destructor is virtual.";
540 text <<
"Default-constructs an instance of "
547 text <<
"Copy-constructs an instance of "
554 text <<
"Move-constructs an instance of "
561 text <<
"Copy-assigns "
564 <<
" to this " << fn
->parent()->name() <<
" instance.";
570 text <<
"Move-assigns "
573 <<
" to this " << fn
->parent()->name() <<
" instance.";
578 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
582 QStringLiteral(
"No documentation for %1 '%2'")
587 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
591 QStringLiteral(
"No documentation for '%1'").arg(node->plainSignature()));
596 generateReimplementsClause(fn, marker);
598 if (
static_cast<
const PropertyNode *>(node)->propertyType() != PropertyNode::PropertyType::StandardProperty)
623 const auto *enume =
static_cast<
const EnumNode *>(node);
625 QSet<QString> definedItems;
626 const QList<EnumItem> &items = enume->items();
627 for (
const auto &item : items)
628 definedItems.insert(item.name());
630 const auto &documentedItemList = enume->doc().enumItemNames();
631 QSet<QString> documentedItems(documentedItemList.cbegin(), documentedItemList.cend());
632 const QSet<QString> allItems = definedItems + documentedItems;
633 if (allItems.size() > definedItems.size()
634 || allItems.size() > documentedItems.size()) {
635 for (
const auto &it : allItems) {
636 if (!definedItems.contains(it)) {
637 node->doc().location().warning(
638 QStringLiteral(
"No such enum item '%1' in %2")
639 .arg(it, node->plainFullName()),
640 QStringLiteral(
"Maybe you meant '%1'?")
641 .arg(suggestName(it, definedItems, documentedItems)));
642 }
else if (!documentedItems.contains(it)) {
643 node->doc().location().warning(
644 QStringLiteral(
"Undocumented enum item '%1' in %2")
645 .arg(it, node->plainFullName()));
658 const QSet<QString> requiredFunctionParams = fn
->parameters().getNames();
659 const QSet<QString> requiredTemplateParams = fn->templateDecl()
660 ? fn->templateDecl()->requiredParameterNamesForFunctions()
662 const QSet<QString> requiredNames = requiredFunctionParams + requiredTemplateParams;
666 const QSet<QString> ownTemplateParams = fn->templateDecl()
667 ? fn->templateDecl()->parameterNames()
669 const QSet<QString> allowedNames = requiredNames + ownTemplateParams
670 + inheritedTemplateParamNames(fn);
672 const QSet<QString> documentedNames = fn
->doc().parameterNames();
675 for (
const auto &name : requiredNames) {
676 if (!documentedNames.contains(name)) {
677 if (fn->isActive() || fn->isPreliminary()) {
680 if (!fn->isMarkedReimp() && !fn->isOverload()
681 && !(fn->isSomeCtor() && fn->hasOverloads())) {
683 const bool isTemplateParam = requiredTemplateParams.contains(name);
684 fn->doc().location().warning(
685 "Undocumented %1 '%2' in %3"_L1
686 .arg(isTemplateParam ?
"template parameter"_L1
688 name, node->plainFullName()));
694 warnAboutUnknownDocumentedParams(fn, documentedNames, allowedNames,
697
698
699
700
703 if (!fn
->doc().body().contains(
"return"))
705 QStringLiteral(
"Undocumented return value "
706 "(hint: use 'return' or 'returns' in the text"));
709 if (
auto *qpn =
static_cast<
const QmlPropertyNode *>(node); !qpn->validateDataType())
710 qpn->doc().location().warning(
"Invalid QML property type: %1"_L1.arg(qpn->dataType()));
716 const QSet<QString> requiredNames = node->templateDecl()->parameterNames();
717 const QSet<QString> allowedNames = requiredNames + inheritedTemplateParamNames(node);
718 const QSet<QString> documentedNames = node
->doc().parameterNames();
721 for (
const auto &name : requiredNames) {
722 if (!documentedNames.contains(name) && CodeParser::isWorthWarningAbout(node->doc())) {
723 node->doc().location().warning(
724 "Undocumented template parameter '%1' in %2"_L1
725 .arg(name, node->plainFullName()));
730 warnAboutUnknownDocumentedParams(node, documentedNames, allowedNames,
739
740
741
742
743
749 const auto *en =
static_cast<
const ExampleNode *>(node);
752 if (exampleUrl.isEmpty()) {
753 if (!en->noAutoList()) {
758 generateLinkToExample(en, marker, exampleUrl);
763
764
765
766
767
768
770 const QString &baseUrl)
772 QString exampleUrl(baseUrl);
774#ifndef QT_BOOTSTRAPPED
775 link = QUrl(exampleUrl).host();
779 link.prepend(
"Example project");
781 const QLatin1Char separator(
'/');
782 const QLatin1Char placeholder(
'\1');
783 if (!exampleUrl.contains(placeholder)) {
784 if (!exampleUrl.endsWith(separator))
785 exampleUrl += separator;
786 exampleUrl += placeholder;
793 pathRoot = metaTagMap->value(QLatin1String(
"installpath"));
794 if (pathRoot.isEmpty())
796 QStringList path = QStringList() << pathRoot << en->name();
797 path.removeAll(QString());
801 <<
Atom(
Atom::Link, exampleUrl.replace(placeholder, path.join(separator)))
811 const QString prefix(
"/images/used-in-examples");
817 s_exampleImageFileNames << prefix.mid(1) +
"/" + resolved_file.get_query();
820 OutputDirectory::ensure(s_outDir, en
->location());
822 outDir.ensureSubdir(prefix.mid(1), en
->location());
824 const QFileInfo fi{resolved_file.get_query()};
825 const QString relativePath = fi.path();
827 const bool hasSubdir = !relativePath.isEmpty() && relativePath !=
"."_L1;
829 hasSubdir ? imagesUsedInExamplesDir.ensureSubdir(relativePath, en
->location())
830 : imagesUsedInExamplesDir;
832 const QString fileName = fi.fileName();
848
849
850
851
852
853
863 paths = en->images();
870 std::sort(paths.begin(), paths.end(), Generator::comparePaths);
875 for (
const auto &path : std::as_const(paths)) {
876 auto maybe_resolved_file{file_resolver.resolve(path)};
877 if (!maybe_resolved_file) {
879 QString details = std::transform_reduce(
880 file_resolver.get_search_directories().cbegin(),
881 file_resolver.get_search_directories().cend(),
882 u"Searched directories:"_s,
884 [](
const DirectoryPath &directory_path) -> QString {
return u' ' + directory_path.value(); }
887 en->location().warning(u"(Generator)Cannot find file to quote from: %1"_s.arg(path), details);
892 const auto &file{*maybe_resolved_file};
894 addImageToCopy(en, file);
896 generateExampleFilePage(en, file, marker);
899 text << Atom(Atom::ListItemNumber, openedList.numberString())
900 << Atom(Atom::ListItemLeft, openedList.styleString()) << Atom::ParaLeft
901 << Atom(atomType, file.get_query()) << Atom(Atom::FormattingLeft,
ATOM_FORMATTING_LINK) << file.get_query()
903 << Atom(Atom::ListItemRight, openedList.styleString());
906 if (!paths.isEmpty())
907 generateText(text, en, marker);
911
912
915 if (!node->url().isNull())
919 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
927
928
932 PageNode *pageNode =
static_cast<PageNode *>(node);
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953 auto *cn =
static_cast<CollectionNode *>(node);
955 m_qdb->mergeCollections(cn);
956 beginSubPage(pageNode, fileName(node));
959 }
else if (cn->isGenericCollection()) {
963 QString name = cn->name().toLower();
964 name.replace(QChar(
' '), QString(
"-"));
966 cn->tree()->physicalModuleName() +
"-" + name +
"." + fileExtension();
967 beginSubPage(pageNode, filename);
972 beginSubPage(pageNode, fileName(node));
978 beginSubPage(pageNode, fileName(node));
982 beginSubPage(pageNode, fileName(node));
983 auto *qcn =
static_cast<QmlTypeNode *>(node);
987 beginSubPage(pageNode, fileName(node));
995 auto *aggregate =
static_cast<Aggregate *>(node);
996 const NodeList &children = aggregate->childNodes();
997 for (
auto *child : children) {
998 if (child->isPageNode()) {
999 generateDocumentation(child);
1000 }
else if (!node->parent() && child->isInAPI() && !child->isRelatedNonmember()
1001 && !child->doc().isAutoGenerated()) {
1003 child->location().warning(u"No documentation generated for %1 '%2' in global scope."_s
1004 .arg(NodeText::nodeTypeDescription(child), child->name()),
1005 u"Maybe you forgot to use the '\\relates' command?"_s);
1006 child->setStatus(Status::DontDocument);
1007 }
else if (child->isQmlModule() && !child->wasSeen()) {
1009 auto *qmlModule =
static_cast<CollectionNode *>(child);
1010 for (
const auto *member : qmlModule->members()) {
1011 member->location().warning(
1012 u"Undocumented QML module '%1' referred by type '%2' or its members"_s
1013 .arg(qmlModule->name(), member->name()),
1014 u"Maybe you forgot to document '\\qmlmodule %1'?"_s
1015 .arg(qmlModule->name()));
1017 }
else if (child->isQmlType() && !child->hasDoc()) {
1019 auto *qmlType =
static_cast<QmlTypeNode *>(child);
1020 if (
auto qmid = qmlType->logicalModuleName(); !qmid.isEmpty())
1021 qmlType->location().warning(u"No such type '%1' in QML module '%2'"_s
1022 .arg(qmlType->name(), qmid));
1034 const FunctionNode *overrides = cn->findOverriddenFunction(fn);
1040 overrides->parent()->name()
1041 +
"::" + overrides->signature(Node::SignaturePlain);
1044 generateText(text, fn, marker);
1046 fn
->doc().location().warning(
1047 QStringLiteral(
"Illegal \\reimp; no documented virtual function for %1")
1048 .arg(overrides->plainSignature()));
1052 const PropertyNode *sameName = cn->findOverriddenProperty(fn);
1053 if (sameName && sameName
->hasDoc()) {
1055 text <<
Atom::ParaLeft <<
"Reimplements an access function for property: ";
1056 QString fullName = sameName->parent()->name() +
"::" + sameName->name();
1059 generateText(text, fn, marker);
1065 QStringList since = node->since().split(QLatin1Char(
' '));
1068 if (since.size() == 1) {
1070 return productName.isEmpty() ? node->since() : productName +
" " + since[0];
1074 return node->since();
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1100 status = metaMap->value(
"status");
1101 if (!status.isEmpty())
1104 const auto &since = node->deprecatedSince();
1106 status = u"Deprecated"_s;
1107 if (!since.isEmpty())
1108 status +=
" since %1"_L1.arg(since);
1109 }
else if (!since.isEmpty()) {
1110 status =
"Until %1"_L1.arg(since);
1114 status = collection->state();
1117 return status.isEmpty() ?
std::nullopt :
std::optional(status);
1122 if (node->since().isEmpty())
1125 const auto *shared = node->isSharedCommentNode()
1126 ?
static_cast<
const SharedCommentNode *>(node) :
nullptr;
1127 const bool plural = shared && shared->collective().size() > 1;
1128 const Node *described = plural ? shared->collective().first() : node;
1133 text << Atom::ParaLeft
1134 << (plural ?
"These "_L1 :
"This "_L1)
1135 << NodeText::nodeTypeDescription(described, number)
1136 << (plural ?
" were "_L1 :
" was "_L1)
1137 <<
"introduced in " << formatSince(node) <<
"." << Atom::ParaRight;
1144 std::vector<
const Node *> nodes;
1146 const auto &collective =
static_cast<
const SharedCommentNode *>(node)->collective();
1147 nodes.assign(collective.begin(), collective.end());
1149 nodes.push_back(node);
1152 std::size_t position = 0;
1153 for (
const Node *member : nodes) {
1155 if (!member->isFunction(Genus::CPP))
1158 const auto &noexceptExpr =
static_cast<
const FunctionNode *>(member)->getNoexcept();
1159 if (!noexceptExpr || noexceptExpr->isEmpty())
1163 if (nodes.size() > 1)
1164 subject =
" ("_L1 + QString::number(position) +
")"_L1;
1166 subject =
"This "_L1 + NodeText::nodeTypeDescription(member);
1169 text << Atom::NoteLeft << subject
1170 <<
" is noexcept when "
1171 << Atom(Atom::C, marker->markedUpCode(*noexceptExpr,
nullptr, Location()))
1172 <<
" is " << Atom(Atom::C,
"true") <<
"." << Atom::NoteRight;
1173 generateText(text, member, marker);
1183 const auto *shared = node->isSharedCommentNode()
1184 ?
static_cast<
const SharedCommentNode *>(node) :
nullptr;
1185 const bool plural = shared && !shared->isPropertyGroup() && shared->collective().size() > 1;
1186 const QString subject = plural
1187 ?
"These "_L1 + NodeText::nodeTypeDescription(shared->collective().first(), NodeText::GrammaticalNumber::Plural) +
" are"_L1
1188 :
"This "_L1 + NodeText::nodeTypeDescription(node) +
" is"_L1;
1194 const QString &state =
static_cast<
const CollectionNode*>(node)->state();
1195 if (!state.isEmpty()) {
1203 if (
const auto &version = node->deprecatedSince(); !version.isEmpty()) {
1205 <<
" scheduled for deprecation in version "
1208 text <<
" " << reason;
1213 auto description = Config::instance()
1225 text << subject <<
" deprecated";
1226 if (
const QString &version = node->deprecatedSince(); !version.isEmpty()) {
1228 if (node
->isQmlNode() && !node->logicalModuleName().isEmpty())
1229 text << node->logicalModuleName() <<
" ";
1233 text <<
". We strongly advise against using " << (plural ?
"them" :
"it")
1238 text <<
" " << reason;
1245 <<
"Part of developer documentation for internal use."
1255
1256
1257
1261 Q_ASSERT(node && !node->name().isEmpty());
1263 text << Atom(Atom::DivLeft,
1264 "class=\"admonition %1\""_L1.arg(prefix == AdmonitionPrefix::Note ? u"note"_s : u"auto"_s));
1279 text <<
"This function can be invoked via the meta-object system and from QML. See "
1285 text <<
"This is a private signal. It can be used in signal connections "
1286 "but cannot be emitted by the user.";
1290 QString handler(node->name());
1291 qsizetype prefixLocation = handler.lastIndexOf(
'.', -2) + 1;
1292 handler[prefixLocation] = handler[prefixLocation].toTitleCase();
1293 handler.insert(prefixLocation, QLatin1String(
"on"));
1294 text <<
"The corresponding handler is "
1303 const auto *fn =
static_cast<
const FunctionNode *>(node);
1304 auto nodes = fn->associatedProperties();
1305 if (nodes.isEmpty())
1310 QMap<PropertyNode::FunctionRole, QList<
const PropertyNode *>> roleGroups;
1311 for (
const auto *n : std::as_const(nodes)) {
1312 const auto *pn =
static_cast<
const PropertyNode *>(n);
1313 if (pn->isInAPI()) {
1314 PropertyNode::FunctionRole role = pn->role(fn);
1315 roleGroups[role].append(pn);
1319 if (roleGroups.isEmpty())
1330 for (
auto role : roleOrder) {
1331 const auto it = roleGroups.constFind(role);
1332 if (it == roleGroups.cend())
1335 const auto &properties = it.value();
1340 msg = u"Getter function"_s;
1343 msg = u"Setter function"_s;
1346 msg = u"Resetter function"_s;
1349 msg = u"Notifier signal"_s;
1352 msg = u"Bindable function"_s;
1358 if (properties.size() == 1) {
1359 const auto *pn = properties.first();
1360 text << msg << u" for property "_s << Atom(Atom::Link, pn->name())
1364 text << msg << u" for properties "_s;
1365 for (qsizetype i = 0; i < properties.size(); ++i) {
1366 const auto *pn = properties.at(i);
1370 << TextUtils::separator(i, properties.size());
1379 text <<
"This property supports "
1383 text <<
" bindings.";
1388 const auto *func =
static_cast<
const FunctionNode *>(node);
1391 if (func->isPrimaryOverload())
1394 if (func->isSignal() || func->isSlot()) {
1395 QString functionType = func->isSignal() ?
"signal" :
"slot";
1396 const QString &configKey = func->isSignal() ?
"overloadedsignalstarget" :
"overloadedslotstarget";
1397 const QString &defaultTarget = func->isSignal() ?
"connecting-overloaded-signals" :
"connecting-overloaded-slots";
1398 const QString &linkTarget = Config::instance().get(configKey).asString(defaultTarget);
1400 text <<
"This " << functionType <<
" is overloaded. ";
1402 QString snippet = generateOverloadSnippet(func);
1403 if (!snippet.isEmpty()) {
1404 text <<
"To connect to this " << functionType <<
":\n\n"
1408 if (!linkTarget.isEmpty()) {
1409 text <<
"For more examples and approaches, see "
1412 <<
"connecting to overloaded " << functionType <<
"s"
1416 const auto &args = node
->doc().overloadList();
1417 if (args.first().first.isEmpty()) {
1418 text <<
"This is an overloaded function.";
1420 QString target = args.first().first;
1423 if (!target.contains(
"::")) {
1426 target = parent->name() +
"::" + target;
1443
1444
1445
1446
1449 bool result =
false;
1460
1461
1462
1463
1464
1465
1466
1467
1471 bool result =
false;
1473 const NodeList &children =
static_cast<
const Aggregate *>(node)->childNodes();
1474 for (
auto child : children) {
1475 if (!child->isDeprecated()) {
1476 switch (child->threadSafeness()) {
1477 case Node::Reentrant:
1478 reentrant.append(child);
1479 if (ts == Node::ThreadSafe)
1482 case Node::ThreadSafe:
1483 threadsafe.append(child);
1484 if (ts == Node::Reentrant)
1487 case Node::NonReentrant:
1488 nonreentrant.append(child);
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1520 if (atom->count() > 1) {
1521 if (s_trademarks.contains(atom->string(1)))
1523 s_trademarks << atom->string(1);
1536
1537
1538
1541 Text text, rlink, tlink;
1546 bool exceptions =
false;
1566 exceptions = hasExceptions(node, reentrant, threadsafe, nonreentrant);
1576 text <<
" with the following exceptions:";
1595 if (!nonreentrant.isEmpty()) {
1597 text <<
"These functions are not " << rlink <<
":" <<
Atom::ParaRight;
1598 signatureList(nonreentrant, node, marker);
1600 if (!threadsafe.isEmpty()) {
1603 text <<
"These functions are also " << tlink <<
":" <<
Atom::ParaRight;
1605 signatureList(threadsafe, node, marker);
1608 if (!reentrant.isEmpty()) {
1610 text <<
"These functions are only " << rlink <<
":" <<
Atom::ParaRight;
1611 signatureList(reentrant, node, marker);
1613 if (!nonreentrant.isEmpty()) {
1616 text <<
"These functions are not " << rlink <<
":" <<
Atom::ParaRight;
1617 signatureList(nonreentrant, node, marker);
1624
1625
1626
1627
1628
1632 if (category == ComparisonCategory::None)
1636 text << Atom::ParaLeft <<
"%1 is "_L1.arg(node->plainFullName())
1638 << QString::fromStdString(comparisonCategoryAsString(category))
1639 << ((category == ComparisonCategory::Equality) ?
"-"_L1 :
"ly "_L1)
1640 << Atom(Atom::String,
"comparable"_L1)
1642 <<
"."_L1 << Atom::ParaRight;
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1666 const auto *map = node
->doc().comparesWithMap();
1668 const bool hasSelfComparison = (selfCategory != ComparisonCategory::None);
1669 const bool hasComparesWithEntries = (map && !map->isEmpty());
1671 if (!hasSelfComparison && !hasComparesWithEntries)
1674 bool hasDescriptions =
false;
1675 if (hasComparesWithEntries) {
1676 for (
const auto &description : *map) {
1677 if (description.firstAtom()->next() != description.lastAtom()) {
1678 hasDescriptions =
true;
1686 text << Atom::ParaLeft
1688 <<
"%1 Comparisons"_L1.arg(node->plainFullName())
1692 text << Atom(Atom::TableLeft,
"generic"_L1);
1694 text << Atom::TableHeaderLeft
1695 << Atom::TableItemLeft <<
"Category"_L1 << Atom::TableItemRight
1696 << Atom::TableItemLeft <<
"Comparable Types"_L1 << Atom::TableItemRight;
1697 if (hasDescriptions)
1698 text << Atom::TableItemLeft <<
"Description"_L1 << Atom::TableItemRight;
1702 if (hasSelfComparison) {
1703 const QString &category = QString::fromStdString(comparisonCategoryAsString(selfCategory));
1709 if (hasDescriptions)
1715 if (hasComparesWithEntries) {
1716 for (
auto [key, description] : map->asKeyValueRange()) {
1717 const QString &category = QString::fromStdString(comparisonCategoryAsString(key));
1719 text << Atom::TableRowLeft;
1721 text << Atom::TableItemLeft << category << Atom::TableItemRight;
1723 text << Atom::TableItemLeft;
1724 const QStringList types{description.firstAtom()->string().split(
';'_L1)};
1725 for (
const auto &name : types)
1726 text << Atom(Atom::AutoLink, name)
1727 << TextUtils::separator(types.indexOf(name), types.size());
1728 text << Atom::TableItemRight;
1730 if (hasDescriptions) {
1731 text << Atom::TableItemLeft;
1732 if (description.firstAtom()->next() != description.lastAtom())
1733 text << Text::subText(description.firstAtom()->next(), description.lastAtom());
1734 text << Atom::TableItemRight;
1737 text << Atom::TableRowRight;
1748
1749
1752 s_currentGenerator =
this;
1764 if (
auto *gen =
dynamic_cast<
Generator *>(producer))
1770 for (
const auto &generator : std::as_const(s_generators)) {
1771 if (generator->format() == format)
1786 while (i < markedCode.size()) {
1787 if (markedCode.at(i) == QLatin1Char(
'\n')) {
1791 for (
int j = 0; j < level; j++)
1792 t += QLatin1Char(
' ');
1796 t += markedCode.at(i++);
1803 Config &config = Config::instance();
1804 s_outputFormats = config.getOutputFormats();
1807 for (
auto &g : s_generators) {
1808 if (s_outputFormats.contains(g->format())) {
1809 s_currentGenerator = g;
1810 OutputProducerRegistry::instance().registerProducer(g);
1811 g->initializeGenerator();
1816 for (
const auto &n : configFormatting) {
1818 const auto &formattingDotNames = config.subVars(formattingDotName);
1819 for (
const auto &f : formattingDotNames) {
1820 const auto &configVar = config.get(formattingDotName + Config::dot + f);
1821 QString def{configVar.asString()};
1822 if (!def.isEmpty()) {
1823 int numParams = Config::numParams(def);
1824 int numOccs = def.count(
"\1");
1825 if (numParams != 1) {
1826 configVar.location().warning(QStringLiteral(
"Formatting '%1' must "
1828 "parameter (found %2)")
1829 .arg(n, numParams));
1830 }
else if (numOccs > 1) {
1831 configVar.location().fatal(QStringLiteral(
"Formatting '%1' must "
1832 "contain exactly one "
1833 "occurrence of '\\1' "
1837 int paramPos = def.indexOf(
"\1");
1838 s_fmtLeftMaps[f].insert(n, def.left(paramPos));
1839 s_fmtRightMaps[f].insert(n, def.mid(paramPos + 1));
1846 s_outDir = config.getOutputDir();
1847 s_outSubdir = s_outDir.mid(s_outDir.lastIndexOf(
'/') + 1);
1849 s_outputPrefixes.clear();
1851 if (!items.isEmpty()) {
1852 for (
const auto &prefix : items)
1853 s_outputPrefixes[prefix] =
1856 if (!items.contains(u"QML"_s))
1857 s_outputPrefixes[u"QML"_s] = u"qml-"_s;
1859 s_outputSuffixes.clear();
1862 + Config::dot + suffix).asString();
1869
1870
1871
1872void Generator::copyTemplateFiles(
const QString &configVar,
const QString &subDir)
1889 Config &config = Config::instance();
1890 QStringList files = config.getCanonicalPathList(configVar,
Config::Validate);
1891 const auto &loc = config.get(configVar)
.location();
1892 if (!files.isEmpty()) {
1902 OutputDirectory::ensure(s_outDir, loc);
1905 outDir.ensureSubdir(subDir, loc);
1907 for (
const auto &file : files) {
1908 if (!file.isEmpty()) {
1909 const QFileInfo fi(file);
1910 Config::copyFile(loc, fi.absoluteFilePath(), fi.fileName(), templateDir.path());
1917
1918
1919
1920
1923 Config &config = Config::instance();
1924 s_outFileNames.clear();
1925 s_generatedPages.clear();
1926 s_exampleImageFileNames.clear();
1927 s_useOutputSubdirs =
true;
1928 if (config.get(format() + Config::dot +
"nosubdirs").asBool())
1931 if (s_outputFormats.isEmpty())
1936 s_outDir = config.getOutputDir(format());
1937 if (s_outDir.isEmpty()) {
1938 Location().fatal(QStringLiteral(
"No output directory specified in "
1939 "configuration file or on the command line"));
1941 s_outSubdir = s_outDir.mid(s_outDir.lastIndexOf(
'/') + 1);
1946 OutputDirectory::ensure(s_outDir,
Location());
1950 if (!outputDir.toQDir().isEmpty())
1951 Location().error(
"Output directory '%1' exists but is not empty"_L1.arg(s_outDir));
1961 outputDir.ensureSubdir(imagesDir,
Location());
1962 s_imagesOutDir =
std::move(imagesDir);
1965 copyTemplateFiles(format() + Config::dot +
CONFIG_SCRIPTS,
"scripts");
1976
1977
1978
1990
1991
1992
1993
1996 return *outStreamStack.top();
2001 return QFileInfo(
static_cast<QFile *>(
out().device())->fileName()).fileName();
2010 return s_outputPrefixes[u"QML"_s];
2012 return s_outputPrefixes[u"CPP"_s];
2025 return s_outputSuffixes[u"QML"_s];
2027 return s_outputSuffixes[u"CPP"_s];
2037 QStringView *contents, QStringView *par1)
2040 if (i >= n || src[i] != c)
2045 while (i < n && src[i] == ' ')
2055 if (tag != QStringView(src).mid(i, tag.size())) {
2067 while (i < n && src[i].isLetter())
2069 if (src[i] ==
'=') {
2074 while (i < n && src[i] !=
'"')
2076 *par1 = QStringView(src).mid(j, i - j);
2087 if (i + 4 + tag.size() > n)
2091 if (src[i + 1] !=
'/')
2093 if (src[i + 2] !=
'@')
2095 if (tag != QStringView(src).mid(i + 3, tag.size()))
2097 if (src[i + 3 + tag.size()] !=
'>')
2102 *contents = QStringView(src).mid(j, i - j);
2104 i += tag.size() + 4;
2114 QString t = markedCode;
2115 t.replace(tag, QString());
2116 t.replace(quot, QLatin1String(
"\""));
2117 t.replace(gt, QLatin1String(
">"));
2118 t.replace(lt, QLatin1String(
"<"));
2119 t.replace(amp, QLatin1String(
"&"));
2127 while (atom && atom
->type() != type) {
2135
2136
2146 m_sectionNumber.clear();
2152 const auto fn =
static_cast<
const FunctionNode *>(node);
2153 if (fn->overloadNumber() == 0) {
2154 QString alternateName;
2157 if (fn->name().startsWith(
"set") && fn->name().size() >= 4) {
2158 alternateName = fn->name()[3].toLower();
2159 alternateName += fn->name().mid(4);
2160 alternateFunc = fn->parent()->findFunctionChild(alternateName, QString());
2162 if (!alternateFunc) {
2163 alternateName =
"is" + fn->name().mid(3);
2164 alternateFunc = fn->parent()->findFunctionChild(alternateName, QString());
2165 if (!alternateFunc) {
2166 alternateName =
"has" + fn->name().mid(3);
2167 alternateFunc = fn->parent()->findFunctionChild(alternateName, QString());
2170 }
else if (!fn->name().isEmpty()) {
2171 alternateName =
"set";
2172 alternateName += fn->name()[0].toUpper();
2173 alternateName += fn->name().mid(1);
2174 alternateFunc = fn->parent()->findFunctionChild(alternateName, QString());
2177 if (alternateFunc && alternateFunc
->access() != Access::Private) {
2179 for (i = 0; i < alsoList.size(); ++i) {
2180 if (alsoList.at(i).toString().contains(alternateName))
2184 if (i == alsoList.size()) {
2187 alternateName +=
"()";
2193 alsoList.prepend(also);
2213 const auto *start{body.firstAtom()};
2219 text << body.subText(text
.isEmpty() ? start : start->next(), end);
2234 for (
const auto &generator : std::as_const(s_generators)) {
2235 if (s_outputFormats.contains(generator->format())) {
2236 OutputProducerRegistry::instance().unregisterProducer(generator);
2237 generator->terminateGenerator();
2264 s_generators.clear();
2266 s_fmtLeftMaps.clear();
2267 s_fmtRightMaps.clear();
2269 s_imagesOutDir.clear();
2275
2276
2277
2278QString
Generator::trimmedTrailing(
const QString &string,
const QString &prefix,
2279 const QString &suffix)
2281 QString trimmed = string;
2282 while (trimmed.size() > 0 && trimmed[trimmed.size() - 1].isSpace())
2283 trimmed.truncate(trimmed.size() - 1);
2285 trimmed.append(suffix);
2286 trimmed.prepend(prefix);
2292 Location::internalError(QStringLiteral(
"unknown atom type '%1' in %2 generator")
2293 .arg(atom->typeString(), format()));
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2330 if (!cn || (cn->cmakeComponent().isEmpty() && cn->cmakePackage().isEmpty())) {
2334 const QString package =
2335 cn->cmakePackage().isEmpty() ?
"Qt" + QString::number(QT_VERSION_MAJOR) : cn->cmakePackage();
2337 QString findPackageText;
2338 if (cn->cmakeComponent().isEmpty()) {
2339 findPackageText =
"find_package(" + package +
" REQUIRED)";
2341 findPackageText =
"find_package(" + package +
" REQUIRED COMPONENTS " + cn->cmakeComponent() +
")";
2345 if (cn->cmakeTargetItem().isEmpty()) {
2346 if (cn->cmakeComponent().isEmpty()) {
2347 targetText = package +
"::" + package;
2349 targetText = package +
"::" + cn->cmakeComponent();
2352 targetText = cn->cmakeTargetItem();
2355 const QString targetLinkLibrariesText =
"target_link_libraries(mytarget PRIVATE " + targetText +
")";
2356 const QStringList cmakeInfo { findPackageText, targetLinkLibrariesText };
2358 return std::make_pair(findPackageText, targetLinkLibrariesText);
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371void Generator::addNodeLink(
Text &text,
const QString &nodeRef,
const QString &linkText) {
2379
2380
2381
2382
2383
2384
2385
2386
2390 Utilities::stringForNode(node),
2391 linkText.isEmpty() ? node->name() : linkText
2396
2397
2398
2399
2400
2401
2402
2408 QString className = func->parent()->name();
2409 QString functionName = func->name();
2410 QString typeList = func->parameters().generateTypeList();
2411 QString typeAndNameList = func->parameters().generateTypeAndNameList();
2412 QString nameList = func->parameters().generateNameList();
2413 QString objectName = generateObjectName(className);
2419 "// Connect using qOverload:\n"
2420 "connect(%1, qOverload<%2>(&%3::%4),\n"
2421 " receiver, &ReceiverClass::slot);\n\n"
2422 "// Or using a lambda:\n"
2423 "connect(%1, qOverload<%2>(&%3::%4),\n"
2424 " this, [](%5) { /* handle %4 */ });")
2425 .arg(objectName, typeList, className, functionName, typeAndNameList);
2428 "// Connect using qOverload:\n"
2429 "connect(sender, &SenderClass::signal,\n"
2430 " %1, qOverload<%2>(&%3::%4));\n\n"
2431 "// Or using a lambda as wrapper:\n"
2432 "connect(sender, &SenderClass::signal,\n"
2433 " %1, [receiver = %1](%5) { receiver->%4(%6); });")
2434 .arg(objectName, typeList, className, functionName, typeAndNameList, nameList);
2441
2442
2443
2446 QString name = className;
2448 if (name.startsWith(
'Q') && name.length() > 1)
2451 if (!name.isEmpty())
2452 name[0] = name[0].toLower();
#define ATOM_FORMATTING_TELETYPE
#define ATOM_FORMATTING_BOLD
#define ATOM_FORMATTING_TRADEMARK
#define ATOM_FORMATTING_ITALIC
#define ATOM_FORMATTING_LINK
#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.
The ClassNode represents a C++ class.
A class for holding the members of a collection of doc pages.
const Location & location() const
bool asBool() const
Returns this config variable as a boolean.
The Config class contains the configuration variables for controlling how qdoc produces documentation...
const Location & location() const
Returns the starting location of a qdoc comment.
const Text & body() const
Text deprecationText() const
QStringMultiMap * metaTagMap() 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 isPrivateSignal() const
QString kindString() const
Returns a string representing the kind of function this Function node represents, which depends on th...
const Parameters & parameters() const
const QString & overridesThis() const
bool isDeprecated() const override
\reimp
bool hasOverloads() const
Returns true if this function has overloads.
bool isMarkedReimp() const override
Returns true if the FunctionNode is marked as a reimplemented function.
bool isIgnored() const
In some cases, it is ok for a public function to be not documented.
bool hasAssociatedProperties() const
void appendSignature(Text &text, const Node *node)
Append the signature for the function named in node to text, so that is a link to the documentation f...
virtual void generateCollectionNode(CollectionNode *, CodeMarker *)
virtual void generateProxyPage(Aggregate *, CodeMarker *)
virtual void generateCppReferencePage(Aggregate *, CodeMarker *)
bool generateComparisonCategory(const Node *node, CodeMarker *marker=nullptr)
QMap< QString, QString > & formattingRightMap()
FileResolver & file_resolver
virtual bool generateText(const Text &text, const Node *relative)
virtual void initializeFormat()
Reads format-specific variables from config, sets output (sub)directories, creates them on the filesy...
virtual void generateDocumentation(Node *node)
Recursive writing of HTML files from the root node.
const Atom * generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, bool generate, int &numGeneratedAtoms)
void generateStatus(const Node *node, CodeMarker *marker)
virtual void generateAlsoList(const Node *node, CodeMarker *marker)
Generates text for a "see also" list for the given node and marker if a list has been defined.
void appendFullName(Text &text, const Node *apparentNode, const Node *relative, const Node *actualNode=nullptr)
virtual void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images)
This function is called when the documentation for an example is being formatted.
void generateThreadSafeness(const Node *node, CodeMarker *marker)
Generates text that explains how threadsafe and/or reentrant node is.
Generator(FileResolver &file_resolver)
Constructs the generator base class.
QString fullDocumentLocation(const Node *node) const
Returns the full document location of node: its page file name and, for a member, the anchor fragment...
static bool useOutputSubdirs()
void generateNoexceptNote(const Node *node, CodeMarker *marker)
void unknownAtom(const Atom *atom)
QString generateObjectName(const QString &className)
Generates an appropriate object name for code snippets based on the class name.
virtual bool generateText(const Text &text, const Node *relative, CodeMarker *marker)
Generate the documentation for relative.
int appendSortedQmlNames(Text &text, const Node *base, const QStringList &knownTypes, const QList< Node * > &subs)
void generateLinkToExample(const ExampleNode *en, CodeMarker *marker, const QString &exampleUrl)
Generates an external link to the project folder for example node.
virtual void terminateGenerator()
QString generateOverloadSnippet(const FunctionNode *func)
Generates a contextual code snippet for connecting to an overloaded signal or slot.
static bool matchAhead(const Atom *atom, Atom::AtomType expectedAtomType)
void addImageToCopy(const ExampleNode *en, const ResolvedFile &resolved_file)
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.
void generateEnumValuesForQmlReference(const Node *node, CodeMarker *marker)
virtual int skipAtoms(const Atom *atom, Atom::AtomType type) const
bool m_threeColumnEnumValueTable
QString linkForExampleFile(const QString &path, const QString &fileExt=QString()) const
Constructs an href link from an example file name, which is a path to the example file.
virtual void generateQmlTypePage(QmlTypeNode *, CodeMarker *)
void signatureList(const QList< Node * > &nodes, const Node *relative, CodeMarker *marker)
Generate a bullet list of function signatures.
void appendFullName(Text &text, const Node *apparentNode, const QString &fullName, const Node *actualNode)
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...
QFile * openSubPageFile(const PageNode *node, const QString &fileName)
Creates the file named fileName in the output directory and returns a QFile pointing to this file.
void beginSubPage(const PageNode *node, const QString &fileName)
Creates the file named fileName in the output directory.
virtual void generatePageNode(PageNode *, CodeMarker *)
virtual ~Generator()
Destroys the generator after removing it from the list of output generators.
void generateSince(const Node *node, CodeMarker *marker)
QMap< QString, QString > & formattingLeftMap()
int appendSortedNames(Text &text, const ClassNode *classe, const QList< RelatedClass > &classes)
void endSubPage()
Flush the text stream associated with the subpage, and then pop it off the text stream stack and dele...
virtual void generateAddendum(const Node *node, Addendum type, CodeMarker *marker)
QString indent(int level, const QString &markedCode)
QString fileName(const Node *node, const QString &extension=QString()) const
If the node has a URL, return the URL as the file name.
virtual void generateAddendum(const Node *node, Addendum type, CodeMarker *marker, AdmonitionPrefix prefix)
static void resetUseOutputSubdirs()
bool generateComparisonTable(const Node *node)
Generates a table of comparison categories for node, combining both self-comparison (from \compares) ...
bool parseArg(const QString &src, const QString &tag, int *pos, int n, QStringView *contents, QStringView *par1=nullptr)
virtual void generateGenericCollectionPage(CollectionNode *, CodeMarker *)
virtual QString fileBase(const Node *node) const
virtual void initializeGenerator()
No-op base implementation.
void initializeTextOutput()
Resets the variables used during text output.
void generateRequiredLinks(const Node *node, CodeMarker *marker)
Generates either a link to the project folder for example node, or a list of links files/images if 'u...
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
static bool requiresDocumentation(const InclusionPolicy &policy, const NodeContext &context)
\variable PublicationLocation::path
static QString resolveDocumentLocation(const Node *node, const FileBase &fileBase, const QString &fileExtension)
Resolves the full document location of node from the caller's fileBase and fileExtension: the page fi...
The Location class provides a way to mark a location in a file.
Location()
Constructs an empty location.
Interface implemented by Node subclasses that can refer to a C++ enum.
virtual const NativeEnum * nativeEnum() const =0
Encapsulates information about native (C++) enum values.
const EnumNode * enumNode() const
QString styleString() const
OpenedList(ListStyle style)
Represents an output directory that has been verified to exist.
const QString & path() const noexcept
Singleton registry for discovering output producers by format.
OutputProducer * producerForFormat(const QString &format) const
Returns the producer registered for format, or nullptr if none.
static OutputProducerRegistry & instance()
Returns the singleton registry instance.
A PageNode is a Node that generates a documentation page.
bool isAttribution() const
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.
NamespaceNode * primaryTreeRoot()
Returns a pointer to the root node of the primary tree.
const CollectionNode * getModuleNode(const Node *relative)
Returns the collection node representing the module that relative node belongs to,...
Status
Specifies the status of the QQmlIncubator.
const Atom * firstAtom() const
#define CONFIG_REDIRECTDOCUMENTATIONTODEVNULL
#define CONFIG_AUTOLINKERRORS
#define CONFIG_EXTRAIMAGES
#define CONFIG_OUTPUTSUFFIXES
#define CONFIG_OUTPUTPREFIXES
#define CONFIG_PRELIMINARY
#define CONFIG_NOLINKERRORS
#define CONFIG_DESCRIPTION
#define CONFIG_EXAMPLESINSTALLPATH
#define CONFIG_PRODUCTNAME
#define CONFIG_QUOTINGINFORMATION
#define CONFIG_STYLESHEETS
#define CONFIG_IMAGESOUTPUTDIR
#define CONFIG_FORMATTING
QMultiMap< QString, QString > QStringMultiMap
Provides human-readable descriptions of QDoc nodes.
QString nodeTypeDescription(const Node *node, GrammaticalNumber number=GrammaticalNumber::Singular)
Pure string helpers with no dependencies on QDoc driver types.
This namespace holds QDoc-internal utility methods.
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.
bool isQmlNode() const
Returns true if this node's Genus value is QML.
virtual bool docMustBeGenerated() const
This function is called to perform a test to decide if the node must have documentation generated.
virtual bool isWrapper() const
Returns true if the node is a class node or a QML type node that is marked as being a wrapper class o...
bool isPrivate() const
Returns true if this node's access is Private.
bool isActive() const
Returns true if this node's status is Active.
bool isNamespace() const
Returns true if the node type is Namespace.
ComparisonCategory comparisonCategory() const
bool hasFileNameBase() const
Returns true if the node's file name base has been set.
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
bool isSharedCommentNode() const
Returns true if the node type is SharedComment.
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.
virtual bool isMacro() const
returns true if either FunctionNode::isMacroWithParams() or FunctionNode::isMacroWithoutParams() retu...
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 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
Access access() const
Returns the node's Access setting, which can be Public, Protected, or Private.
bool isFunction(Genus g=Genus::DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
ThreadSafeness threadSafeness() const
Returns the thread safeness value for whatever this node represents.
virtual bool isMarkedReimp() const
Returns true if the FunctionNode is marked as a reimplemented function.
bool isProperty() const
Returns true if the node type is Property.
NodeContext createContext() const
bool isModule() const
Returns true if the node type is Module.
ThreadSafeness
An unsigned char that specifies the degree of thread-safeness of the element.
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...
bool isPreliminary() const
Returns true if this node's status is Preliminary.
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.
bool isQmlModule() const
Returns true if the node type is QmlModule.
bool isExample() const
Returns true if the node type is Example.
bool isIndexNode() const
Returns true if this node was created from something in an index file.
bool isQmlProperty() const
Returns true if the node type is QmlProperty.
Represents a file that is reachable by QDoc based on its current configuration.