Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
template_declaration.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#pragma once
5
6#include <algorithm>
7#include <cstddef>
8#include <cstdint>
9#include <functional>
10#include <numeric>
11#include <optional>
12#include <string>
13#include <vector>
14
15#include <QSet>
16#include <QString>
17
18namespace QDoc {
19// Template declarations with more than this many parameters
20// are rendered in multi-line format for improved readability.
22} // namespace QDoc
23
24/*
25 * Represents a general declaration that has a form that can be
26 * described by a type, name and initializer triplet, or any such form
27 * that can be described by zero or more of those same parts.
28 *
29 * For example, it can be used to represent a C++ variable declaration
30 * such as:
31 *
32 * std::vector<int> foo = { 1, 2, 3 };
33 *
34 * Where `std::vector<int>` is the type, `foo` is the name and `{ 1, 2,
35 * 3 }` is the initializer.
36 *
37 * Similarly, it can be used to represent a non-type template parameter
38 * declaration, such as the `foo` parameter in:
39 *
40 * template<int foo = 10>
41 *
42 * Where `int` is the type, `foo` is the name and `10` is the
43 * initializer.
44 *
45 * An instance can be used to represent less information dense elements
46 * by setting one or more of the fields as the empty string.
47 *
48 * For example, a template type parameter such as `T` in:
49 *
50 * template<typename T = int>
51 *
52 * Can be represented by an instance that has an empty string as the
53 * type, `T` as the name and `int` as the initializer.
54 *
55 * In general, it can be used to represent any such element that has
56 * zero or more of the three components, albeit, in QDoc, it is
57 * specifically intended to be used to represent various C++
58 * declarations.
59 *
60 * All three fields are lowered stringified version of the original
61 * declaration, so that the type should be used at the end of a
62 * pipeline where the semantic property of the represented code are not
63 * required.
64 */
66{
68 {
69 bool include_type = true;
70 bool include_name = true;
72 };
73
74 std::string type;
75 std::string name;
77
78 // KLUDGE: Workaround for
79 // https://stackoverflow.com/questions/53408962/try-to-understand-compiler-error-message-default-member-initializer-required-be
81
82 /*
83 * Constructs and returns a human-readable representation of this
84 * declaration.
85 *
86 * The constructed string is formatted so that as to rebuild a
87 * possible version of the C++ code that is modeled by an instance
88 * of this type.
89 *
90 * Each component participates in the human-presentable version if
91 * it they are not the empty string.
92 *
93 * The "type" and "name" component participate with their literal
94 * representation.
95 *
96 * The "iniitlalizer" components contributes an equal symbol,
97 * followed by a space followed by the literal representation of
98 * the component.
99 *
100 * The component contributes in an ordered way, with "type"
101 * contributing first, "name" contributing second and
102 * "initializer" contributing last.
103 *
104 * Each contribution is separated by a space if the component that
105 * comes before it, if any, has contributed to the human-readable
106 * representation.
107 *
108 * For example, an instance of this type that has "type" component
109 * "int", "name" component "foo" and "iniitializer" component
110 * "100", would be represented as:
111 *
112 * int foo = 100
113 *
114 * Where "int" is the "type" component contribution, "foo" is the
115 * "name" component contribution and "= 100" is the "initializer"
116 * component contribution.
117 * Each of those contribution is separated by a space, as each
118 * "preceding" component has contributed to the representation.
119 *
120 * If we provide a similar instance with, for example, the "type"
121 * and "name" components as the empty string, then the
122 * representation would be "= 100", which is the "initializer"
123 * component contribution, the only component that is not the
124 * empty string.
125 *
126 * The policy argument allows to treat certain components as if
127 * they were the empty string.
128 *
129 * For example, given an instance of this type that has "type"
130 * component "double", "name" component "bar" and "iniitializer"
131 * component "10.2", its human-readable representation would be
132 * "double bar = 10.2".
133 *
134 * If the representation of that same instance was obtained by
135 * using a policy that excludes the "name" component, then that
136 * representation would be "double = 10.2", which is equivalent
137 * to the representation of an instance that is the same as the
138 * orginal one with the "name" component as the empty string.
139 */
141 {
142 std::string s{};
143
144 if (!type.empty() && policy.include_type)
145 s += (s.empty() ? "" : " ") + type;
146
147 if (!name.empty() && policy.include_name)
148 s += (s.empty() ? "" : " ") + name;
149
150 if (!initializer.empty() && policy.include_initializer)
151 s += (s.empty() ? "= " : " = ") + initializer;
152
153 return s;
154 }
155};
156
157/*!
158 * Holds the source-level alias with its template arguments for a
159 * SFINAE constraint detected in a non-type template parameter.
160 *
161 * For example, given the declaration:
162 *
163 * template <typename T, if_integral<T> = true>
164 *
165 * where \c if_integral is an alias for \c{std::enable_if_t<std::is_integral_v<T>, bool>},
166 * alias_with_args is "if_integral<T>".
167 */
169{
171};
172
174
181
182/*
183 * Represents a C++ template parameter.
184 *
185 * The model used by this representation is a slighly simplified
186 * model.
187 *
188 * In the model, template parameters are one of:
189 *
190 * - A type template parameter.
191 * - A non type template parameter.
192 * - A template template parameter.
193 *
194 * Furthermore, each parameter can:
195 *
196 * - Be a parameter pack.
197 * - Carry an additional template declaration (as a template template
198 * parameter would).
199 * - Have no declared type.
200 * - Have no declared name.
201 * - Have no declared initializer.
202 *
203 * Due to this simplified model certain incorrect parameters can be
204 * represented.
205 *
206 * For example, it might be possible to represent a parameter pack
207 * that has a default initializer, a non-type template parameter that
208 * has no type or a template template parameter that carries no
209 * template declaration.
210 *
211 * The model further elides some of the semantic that might be carried
212 * by a parameter.
213 * For example, the model has no specific concept for template
214 * constraints.
215 *
216 * Template parameters can be represented as instances of the type.
217 *
218 * For example, a type template parameter `typename T` can be
219 * represented as the following instance:
220 *
221 * RelaxedTemplateParameter{
222 * RelaxedTemplateParameter::Kind::TypeTemplateParameter,
223 * false,
224 * {
225 * "",
226 * "T",
227 * ""
228 * },
229 * {}
230 * };
231 *
232 * And a non-type template parameter pack "int... Args" as:
233 *
234 * RelaxedTemplateParameter{
235 * RelaxedTemplateParameter::Kind::NonTypeTemplateParameter,
236 * true,
237 * {
238 * "int",
239 * "Args",
240 * ""
241 * },
242 * {}
243 * };
244 *
245 * Due to the relaxed constraint and the representable incorrect
246 * parameters, the type is intended to be used for data that is
247 * already validated and known to be correct, such as data that is
248 * extracted from Clang.
249 */
251{
257
263 std::optional<std::string> concept_name;
264
265 /*
266 * Constructs and returns a human-readable representation of this
267 * parameter.
268 *
269 * The constructed string is formatted so that as to rebuild a
270 * possible version of the C++ code that is modeled by an instance
271 * of this type.
272 *
273 * The format of the representation varies based on the "kind" of
274 * the parameter.
275 *
276 * - A "TypeTemplateParameter", is constructed as the
277 * concatenation of the literal "typename", followed by the
278 * literal "..." if the parameter is a pack, followed by the
279 * human-readable representaion of "valued_declaration".
280 *
281 * If the human-readable representation of
282 * "valued_declaration" is not the empty string, it is
283 * preceded by a space when it contributes to the
284 * representation.
285 *
286 * For example, the C++ type template parameter "typename Foo
287 * = int", would be represented by the instance:
288 *
289 * RelaxedTemplateParameter{
290 * RelaxedTemplateParameter::Kind::TypeTemplateParameter,
291 * false,
292 * {
293 * "",
294 * "Foo",
295 * "int"
296 * },
297 * {}
298 * };
299 *
300 * And its representation would be:
301 *
302 * typename Foo = int
303 *
304 * Where "typename" is the added literal and "Foo = int" is
305 * the representation for "valued_declaration", with a space
306 * in-between the two contributions.
307 *
308 * - A "NonTypeTemplateParameter", is constructed by the
309 * contribution of the "type" compoment of "valued_declaration",
310 * followed by the literal "..." if the parameter is a pack,
311 * followed by the human-presentable version of
312 * "valued_declaration" without its "type" component
313 * contribution.
314 *
315 * If the contribution of the "type" component of
316 * "valued_declaration" is not empty, the next contribution is
317 * preceded by a space.
318 *
319 * For example, the C++ non-type template parameter "int...
320 * SIZE", would be represented by the instance:
321 *
322 *
323 * RelaxedTemplateParameter{
324 * RelaxedTemplateParameter::Kind::NonTypeTemplateParameter,
325 * true,
326 * {
327 * "int",
328 * "SIZE",
329 * ""
330 * },
331 * {}
332 * };
333 *
334 * And its representation would be:
335 *
336 * int... SIZE
337 *
338 * Where "int" is the "type" component contribution of
339 * "valued_declaration", "..." is the added literal due to
340 * the parameter being a pack and " SIZE" being the
341 * human-readable representation of "valued_declaration"
342 * without its "type" component contribution, preceded by a
343 * space.
344 *
345 * - A "TemplateTemplateParameter", is constructed by the
346 * contribution of the human-presentable representation of
347 * "template_declaration", followed by the representation of
348 * this parameter if it was a "TypeTemplateParameter", with a
349 * space between the two contributions if the
350 * human-presentable representation of "template_declaration"
351 * is not empty.
352 *
353 * For example, the C++ template template template parameter
354 * "template<typename> T", would be represented by the
355 * instance:
356 *
357 *
358 * RelaxedTemplateParameter{
359 * RelaxedTemplateParameter::Kind::TemplateTemplateParameter,
360 * false,
361 * {
362 * "",
363 * "T",
364 * ""
365 * },
366 * {
367 * RelaxedTemplateParameter{
368 * RelaxedTemplateParameter::Kind::TypeTemplateParameter,
369 * false,
370 * {
371 * "",
372 * "",
373 * ""
374 * },
375 * {}
376 * }
377 * }
378 * };
379 *
380 * And its representation would be:
381 *
382 * template <typename> typename T
383 *
384 * Where "template <typename>" human-presentable version of
385 * "template_declaration" and "typename T" is the
386 * human-presentable version of this parameter if it was a
387 * type template parameter.
388 *
389 * With a space between the two contributions.
390 */
391 inline std::string to_std_string() const
392 {
393 switch (kind) {
394 // TODO: This can probably be moved under the template
395 // template parameter case and reused through a fallback.
397 std::string valued_declaration_string = valued_declaration.to_std_string();
398
399 // Direct concept-on-template-parameter form (such as
400 // template <Integral T>): show the concept name instead of
401 // the bare typename keyword. This plain string feeds consumers
402 // that have no concept rendering of their own — the DocBook
403 // plain-text subtitle and template-parameter comparison. The
404 // rich paths (the HTML subtitle atoms and the DocBook autolink
405 // step) build their own linked rendering and bypass this.
406 std::string head = concept_name
407 ? concept_name->substr(concept_name->rfind("::") == std::string::npos
408 ? 0
409 : concept_name->rfind("::") + 2)
410 : std::string("typename");
411
412 return head + (is_parameter_pack ? "..." : "")
413 + (valued_declaration_string.empty() ? "" : " ") + valued_declaration_string;
414 }
416 std::string type_string = valued_declaration.type + (is_parameter_pack ? "..." : "");
417
418 return type_string + (type_string.empty() ? "" : " ")
420 ValuedDeclaration::PrintingPolicy{ false, true, true });
421 }
423 std::string valued_declaration_string = valued_declaration.to_std_string();
424
425 return (template_declaration ? (*template_declaration).to_std_string() + " " : "")
426 + "typename" + (is_parameter_pack ? "..." : "")
427 + (valued_declaration_string.empty() ? "" : " ") + valued_declaration_string;
428 }
429 default:
430 return "";
431 }
432 }
433};
434
435/*
436 * Represents a C++ template declaration as a collection of template
437 * parameters.
438 *
439 * The parameters for the declaration follow the same relaxed rules as
440 * `RelaxedTemplateParameter` and inherit the possibility of
441 * representing incorrect declarations.
442 *
443 * Due to the relaxed constraint and the representable incorrect
444 * parameters, the type is intended to be used for data that is
445 * already validated and known to be correct, such as data that is
446 * extracted from Clang.
447 *
448 * The optional requires_clause field holds a C++20 requires clause
449 * constraint expression, if present. For example, for a template
450 * declared as `template<typename T> requires std::integral<T>`, the
451 * requires_clause is \e {std::integral<T>}.
452 *
453 * Note: The inherited to_std_string() method does not include requires_clause
454 * because it is used for internal comparisons (such as template declaration
455 * substitutability) where the constraint is not relevant. Use to_qstring() or
456 * to_qstring_multiline() for user-facing output that should include requires
457 * clauses.
458 */
460{
461 std::optional<std::string> requires_clause;
463
464 /*!
465 * Returns the number of template parameters that are visible in
466 * rendered output — SFINAE-annotated parameters are excluded.
467 */
468 [[nodiscard]] inline std::size_t visibleParameterCount() const
469 {
470 return std::count_if(parameters.cbegin(), parameters.cend(),
471 [](const RelaxedTemplateParameter &p) {
472 return !p.sfinae_constraint;
473 });
474 }
475
476 /*!
477 * Returns a string representation that excludes SFINAE-annotated
478 * parameters. Used by to_qstring() and to_qstring_multiline() so
479 * that the rendered signature shows a clean requires clause.
480 *
481 * The inherited to_std_string() retains all parameters (including
482 * SFINAE ones) for internal matching where parameter counts must
483 * agree between code-parsed and \\fn-parsed declarations.
484 */
485 [[nodiscard]] inline std::string to_std_string_for_rendering() const
486 {
487 std::vector<const RelaxedTemplateParameter *> visible;
488 for (const auto &p : parameters)
489 if (!p.sfinae_constraint)
490 visible.push_back(&p);
491
492 if (visible.empty())
493 return "template <>";
494
495 std::string result = "template <" + visible.front()->to_std_string();
496 for (std::size_t i = 1; i < visible.size(); ++i)
497 result += ", " + visible[i]->to_std_string();
498 result += ">";
499 return result;
500 }
501
502 inline QString to_qstring() const {
503 std::string result = to_std_string_for_rendering();
504 if (requires_clause && !requires_clause->empty())
505 result += " requires " + *requires_clause;
506 return QString::fromStdString(result);
507 }
508
509 /*
510 * Returns a multi-line representation of the template declaration,
511 * suitable for rendering complex templates with many parameters.
512 *
513 * The format places each parameter on its own line with consistent
514 * indentation:
515 *
516 * template <
517 * typename T,
518 * typename U = SomeLongType
519 * >
520 *
521 * This format works well with variable-width fonts since indentation
522 * uses a fixed number of spaces rather than alignment.
523 *
524 * If a requires clause is present, it appears after the closing '>':
525 *
526 * template <
527 * typename T
528 * > requires std::integral<T>
529 */
531 if (parameters.empty()) {
532 QString result = QStringLiteral("template <>");
533 if (requires_clause && !requires_clause->empty())
534 result += QStringLiteral(" requires ") + QString::fromStdString(*requires_clause);
535 return result;
536 }
537
538 // Collect non-SFINAE parameters for rendering.
539 std::vector<const RelaxedTemplateParameter *> visible;
540 for (const auto &p : parameters)
541 if (!p.sfinae_constraint)
542 visible.push_back(&p);
543
544 if (visible.empty()) {
545 QString result = QStringLiteral("template <>");
546 if (requires_clause && !requires_clause->empty())
547 result += QStringLiteral(" requires ") + QString::fromStdString(*requires_clause);
548 return result;
549 }
550
551 QString result = QStringLiteral("template <\n");
552 for (std::size_t i = 0; i < visible.size(); ++i) {
553 result += QStringLiteral(" ") + QString::fromStdString(visible[i]->to_std_string());
554 if (i + 1 < visible.size())
555 result += QLatin1Char(',');
556 result += QLatin1Char('\n');
557 }
558 result += QLatin1Char('>');
559
560 if (requires_clause && !requires_clause->empty())
561 result += QStringLiteral(" requires ") + QString::fromStdString(*requires_clause);
562
563 return result;
564 }
565
566 /*!
567 * Returns the set of all declared template parameter names.
568 *
569 * This extracts the name from each template parameter's valued_declaration.
570 * Parameters without names (such as unnamed template parameters) are not
571 * included in the returned set.
572 *
573 * This is useful for documentation validation, allowing QDoc to verify
574 * that template parameters can be referenced using the \\a command.
575 */
576 [[nodiscard]] inline QSet<QString> parameterNames() const
577 {
578 QSet<QString> names;
579 for (const auto &param : parameters) {
580 if (!param.valued_declaration.name.empty())
581 names.insert(QString::fromStdString(param.valued_declaration.name));
582 }
583 return names;
584 }
585
586 /*!
587 * Returns the set of template parameter names that are API-significant
588 * and should be documented for functions.
589 *
590 * This includes only non-type template parameters (such as \c{int Size})
591 * and template-template parameters, which carry meaning that isn't
592 * implied by function parameter types.
593 *
594 * Type template parameters (such as \c{typename T}) are excluded because
595 * they typically serve to type function parameters, and documenting the
596 * function parameter implicitly covers the template parameter's role.
597 *
598 * For class template parameters, use parameterNames() instead, as all
599 * template parameters are part of the class's primary API surface.
600 */
601 [[nodiscard]] inline QSet<QString> requiredParameterNamesForFunctions() const
602 {
603 QSet<QString> names;
604 for (const auto &param : parameters) {
605 if (param.kind != RelaxedTemplateParameter::Kind::TypeTemplateParameter
606 && !param.valued_declaration.name.empty()) {
607 names.insert(QString::fromStdString(param.valued_declaration.name));
608 }
609 }
610 return names;
611 }
612};
613
614/*
615 * Constructs and returns a human-readable representation of this
616 * declaration.
617 *
618 * The constructed string is formatted so as to rebuild a
619 * possible version of the C++ code that is modeled by an instance
620 * of this type.
621 *
622 * The representation of a declaration is constructed by the literal
623 * "template <", followed by the human-presentable version of each
624 * parameter in "parameters", with a comma and a space between each
625 * parameter, followed by a closing literal ">".
626 *
627 * For example, the empty declaration is represented as "template <>".
628 *
629 * While a template declaration that has a type template parameter
630 * "Foo" with initializer "int" and a non-type template parameter pack
631 * with type "int" and name "S" would be represented as:
632 *
633 * template <typename Foo = int, int... S>
634 */
636{
637 if (parameters.empty())
638 return "template <>";
639
640 return "template <"
641 + std::accumulate(std::next(parameters.cbegin()), parameters.cend(),
642 parameters.front().to_std_string(),
643 [](auto &&acc, const RelaxedTemplateParameter &parameter) {
644 return acc + ", " + parameter.to_std_string();
645 })
646 + ">";
647}
648
649/*
650 * Returns true if the two template declaration represented by left
651 * and right are substitutable.
652 *
653 * QDoc uses a simplified model for template declarations and,
654 * similarly, uses a simplified model of "substitutability".
655 *
656 * Two declarations are substitutable if:
657 *
658 * - They have the same amount of parameters
659 * - For each pair of parameters with the same postion:
660 * - They have the same kind
661 * - They are both parameter packs or both are not parameter packs
662 * - If they are non-type template parameters then they have the same type
663 * - If they are both template template parameters then they both
664 * carry an additional template declaration and the additional
665 * template declarations are substitutable
666 *
667 * This means that in the simplified models, we generally ignore default arguments, name and such.
668 *
669 * This model does not follow the way C++ performs disambiguation but
670 * should be enough to handle most cases in the documentation.
671 */
673 static auto are_template_parameters_substitutable = [](const RelaxedTemplateParameter& left, const RelaxedTemplateParameter& right) {
674 if (left.kind != right.kind) return false;
675 if (left.is_parameter_pack != right.is_parameter_pack) return false;
676
679 return false;
680
682 if (!left.template_declaration && right.template_declaration) return false;
683 if (left.template_declaration && !right.template_declaration) return false;
684
685 if (left.template_declaration && right.template_declaration)
686 return are_template_declarations_substitutable(*left.template_declaration, *right.template_declaration);
687 }
688
689 return true;
690 };
691
692 const auto& left_parameters = left.parameters;
693 const auto& right_parameters = right.parameters;
694
695 if (left_parameters.size() != right_parameters.size()) return false;
696
697 return std::transform_reduce(left_parameters.cbegin(), left_parameters.cend(), right_parameters.cbegin(),
698 true,
699 std::logical_and<bool>{},
700 are_template_parameters_substitutable
701 );
702}
std::optional< PCHFile > buildPCH(QDocDatabase *qdb, QString module_header, const std::set< Config::HeaderFilePath > &all_headers, const std::vector< QByteArray > &include_paths, const QList< QByteArray > &defines, const InclusionPolicy &policy)
Building the PCH must be possible when there are no .cpp files, so it is moved here to its own member...
struct CXTranslationUnitImpl * CXTranslationUnit
ParsedCppFileIR parse_cpp_file(const QString &filePath)
Get ready to parse the C++ cpp file identified by filePath and add its parsed contents to the databas...
ClangCodeParser(QDocDatabase *qdb, Config &, const std::vector< QByteArray > &include_paths, const QList< QByteArray > &defines, std::optional< std::reference_wrapper< const PCHFile > > pch)
The ClassNode represents a C++ class.
Definition classnode.h:23
static void initialize()
All the code markers in the static list are initialized here, after the qdoc configuration file has b...
static void terminate()
All the code markers in the static list are terminated here.
static const QSet< QString > common_meta_commands
Definition codeparser.h:111
virtual void initializeParser()=0
virtual void terminateParser()
Terminating a code parser is trivial.
CodeParser()
The constructor adds this code parser to the static list of code parsers.
static void setLink(Node *node, Node::LinkType linkType, const QString &arg)
virtual QString language()=0
virtual void parseSourceFile(const Location &location, const QString &filePath, CppCodeParser &cpp_code_parser)=0
QDocDatabase * m_qdb
Definition codeparser.h:140
static CodeParser * parserForLanguage(const QString &language)
static CodeParser * parserForSourceFile(const QString &filePath)
static bool isWorthWarningAbout(const Doc &doc)
Test for whether a doc comment warrants warnings.
virtual QStringList sourceFileNameFilter()=0
virtual ~CodeParser()
The destructor removes this code parser from the static list of code parsers.
static void extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc)
static void initialize()
All the code parsers in the static list are initialized here, after the qdoc configuration variables ...
static void terminate()
All the code parsers in the static list are terminated here.
A class for holding the members of a collection of doc pages.
const Location & location() const
Definition config.h:55
bool asBool() const
Returns this config variable as a boolean.
Definition config.cpp:282
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:95
static const QString dot
Definition config.h:179
bool singleExec() const
Definition config.h:469
@ Validate
Definition config.h:114
@ IncludePaths
Definition config.h:115
const Location & location() const
Definition config.h:137
const ExcludedPaths & getExcludedPaths()
Definition config.cpp:1439
bool dualExec() const
Definition config.h:474
bool preparing() const
Definition config.h:198
bool generating() const
Definition config.h:199
bool getDebug() const
Definition config.h:119
static QString overrideOutputDir
Definition config.h:183
CppCodeParser(FnCommandParser &&parser)
static void processMetaCommands(const Doc &doc, Node *node)
The topic command has been processed, and now doc and node are passed to this function to get the met...
DocBookGenerator(FileResolver &file_resolver)
Definition doc.h:32
QSet< QString > parameterNames() const
Definition doc.cpp:200
Text legaleseText() const
Definition doc.cpp:192
QList< Text > alsoList() const
Definition doc.cpp:280
const Location & location() const
Returns the starting location of a qdoc comment.
Definition doc.cpp:89
Doc & operator=(const Doc &doc)
Definition doc.cpp:74
Doc(const Location &start_loc, const Location &end_loc, const QString &source, const QSet< QString > &metaCommandSet, const QSet< QString > &topics)
Parse the qdoc comment source.
Definition doc.cpp:46
const QList< Atom * > & tableOfContents() const
Definition doc.cpp:300
const Text & title() const
Definition doc.cpp:120
bool isInternal() const
Returns true if the set of metacommands used in the doc comment contains {internal}...
Definition doc.cpp:224
bool hasTableOfContents() const
Definition doc.cpp:285
bool hasOverloadCommand() const
Definition doc.h:75
static void quoteFromFile(const Location &location, Quoter &quoter, ResolvedFile resolved_file, CodeMarker *marker=nullptr)
Definition doc.cpp:461
const QList< Atom * > & keywords() const
Definition doc.cpp:320
~Doc()
Definition doc.cpp:68
const Text & body() const
Definition doc.cpp:114
static void initialize(FileResolver &file_resolver)
Definition doc.cpp:356
bool hasKeywords() const
Definition doc.cpp:290
QStringList omitEnumItemNames() const
Definition doc.cpp:210
const QList< Atom * > & targets() const
Definition doc.cpp:330
QMultiMap< ComparisonCategory, Text > * comparesWithMap() const
Definition doc.cpp:345
const QList< int > & tableOfContentsLevels() const
Definition doc.cpp:310
bool hasTargets() const
Definition doc.cpp:295
Text trimmedBriefText(const QString &className) const
Definition doc.cpp:131
Sections
Definition doc.h:35
@ NoSection
Definition doc.h:36
@ Section3
Definition doc.h:39
@ Section1
Definition doc.h:37
@ Section2
Definition doc.h:38
@ Section4
Definition doc.h:40
ArgList metaCommandArgs(const QString &metaCommand) const
Definition doc.cpp:275
Text briefText(bool inclusive=false) const
Definition doc.cpp:126
const Location & startLocation() const
Returns the starting location of a qdoc comment.
Definition doc.cpp:98
Doc()=default
bool isMarkedReimp() const
Returns true if the set of metacommands used in the doc comment contains {reimp}.
Definition doc.cpp:233
void markAutoGenerated()
Marks this documentation as auto-generated by QDoc.
Definition doc.cpp:250
static void trimCStyleComment(Location &location, QString &str)
Replaces any asterisks used as a left margin in the comment str with spaces then trims the comment sy...
Definition doc.cpp:421
bool isAutoGenerated() const
Returns true if this documentation was auto-generated by QDoc rather than written by an author.
Definition doc.cpp:242
static void terminate()
All the heap allocated variables are deleted.
Definition doc.cpp:409
QList< ArgPair > overloadList() const
Returns the list of arguments passed to the {\overload} command.
Definition doc.cpp:260
TopicList topicsUsed() const
Returns a reference to the list of topic commands used in the current qdoc comment.
Definition doc.cpp:270
QStringMultiMap * metaTagMap() const
Definition doc.cpp:340
QSet< QString > metaCommandsUsed() const
Definition doc.cpp:215
bool isEmpty() const
Definition doc.cpp:109
Doc(const Doc &doc)
Definition doc.cpp:63
void constructExtra() const
Definition doc.cpp:350
const QString & source() const
Definition doc.cpp:103
QStringList enumItemNames() const
Definition doc.cpp:205
Encapsulate the logic that QDoc uses to find files whose path is provided by the user and that are re...
std::optional< ResolvedFile > resolve(QString filename) const
Returns a ResolvedFile if query can be resolved or std::nullopt otherwise.
FileResolver(std::vector< DirectoryPath > &&search_directories)
Constructs an instance of FileResolver with the directories in search_directories as root directories...
const std::vector< DirectoryPath > & get_search_directories() const
Returns a const-reference to a collection of root search directories that this instance will use duri...
This node is used to represent any kind of function being documented.
static void initialize()
static void terminate()
static Generator * generatorForFormat(const QString &format)
HtmlGenerator(FileResolver &file_resolver)
Definition inode.h:20
virtual const QString & name() const =0
virtual Genus genus() const =0
virtual NodeType nodeType() const =0
virtual QString fullName() const =0
virtual ~INode()=default
The Location class provides a way to mark a location in a file.
Definition location.h:20
QString fileName() const
Returns the file name part of the file path, ie the current file.
Definition location.cpp:224
void fatal(const QString &message, const QString &details=QString()) const
Writes message and details to stderr as a formatted error message and then exits the program.
Definition location.cpp:302
QString fileSuffix() const
Returns the suffix of the file name.
Definition location.cpp:234
const QString & filePath() const
Returns the current path and file name.
Definition location.h:47
bool operator==(const Location &other) const
Returns true if this instance points to the same location as other.
Definition location.cpp:106
Location(const Location &other)
The copy constructor copies the contents of other into this Location using the assignment operator.
Definition location.cpp:67
void setColumnNo(int no)
Definition location.h:43
void error(const QString &message, const QString &details=QString()) const
Writes message and details to stderr as a formatted error message.
Definition location.cpp:271
int lineNo() const
Returns the current line number.
Definition location.h:50
static int exitCode()
Returns the error code QDoc should exit with; EXIT_SUCCESS or the number of documentation warnings if...
Definition location.cpp:283
void report(const QString &message, const QString &details=QString()) const
Writes message and details to stderr as a formatted report message.
Definition location.cpp:321
QString toString() const
Converts the location to a string to be prepended to error messages.
Definition location.cpp:566
bool operator!=(const Location &other) const
Returns true if this instance does not point to the same location as other.
Definition location.cpp:124
int columnNo() const
Returns the current column number.
Definition location.h:51
void advanceLines(int n)
Definition location.h:33
static void initialize()
Gets several parameters from the config, including tab size, program name, and a regular expression t...
Definition location.cpp:336
Location()
Constructs an empty location.
Definition location.cpp:48
static void information(const QString &message)
Prints message to stdout followed by a {' '}.
Definition location.cpp:494
int depth() const
Definition location.h:46
void push(const QString &filePath)
Pushes filePath onto the file position stack.
Definition location.cpp:168
static void internalError(const QString &hint)
Report a program bug, including the hint.
Definition location.cpp:503
void start()
If the file position on top of the stack has a line number less than 1, set its line number to 1 and ...
Definition location.cpp:134
void warning(const QString &message, const QString &details=QString()) const
Writes message and details to stderr as a formatted warning message.
Definition location.cpp:259
void setEtc(bool etc)
Definition location.h:41
void advance(QChar ch)
Advance the current file position, using ch to decide how to do that.
Definition location.cpp:150
void setLineNo(int no)
Definition location.h:42
Location & operator=(const Location &other)
The assignment operator does a deep copy of the entire state of other into this Location.
Definition location.cpp:77
bool isEmpty() const
Returns true if there is no file name set yet; returns false otherwise.
Definition location.h:45
bool etc() const
Definition location.h:52
~Location()
Definition location.h:25
static void terminate()
Apparently, all this does is delete the regular expression used for intercepting certain error messag...
Definition location.cpp:482
void pop()
Pops the top of the internal stack.
Definition location.cpp:188
Location(const QString &filePath)
Constructs a location with (fileName, 1, 1) on its file position stack.
Definition location.cpp:57
This class represents a C++ namespace.
Tree * tree() const override
Returns a pointer to the Tree that contains this NamespaceNode.
Represents an output directory that has been verified to exist.
A PageNode is a Node that generates a documentation page.
Definition pagenode.h:19
The Parameter class describes one function parameter.
Definition parameter.h:14
const QString & type() const
Definition parameter.h:24
void set(const QString &type, const QString &name, const QString &defaultValue=QString())
Definition parameter.h:29
const QString & name() const
Definition parameter.h:25
void setDefaultValue(const QString &t)
Definition parameter.h:27
qsizetype nameInsertionPoint() const
Returns the position within the type string where the parameter name should be inserted,...
Definition parameter.cpp:38
Parameter(QString type, QString name=QString(), QString defaultValue=QString())
Definition parameter.h:17
Parameter()=default
QString signature(bool includeValue=false) const
Reconstructs the text signature for the parameter and returns it.
Definition parameter.cpp:53
void setCanonicalType(const QString &t)
Definition parameter.h:40
void setName(const QString &name)
Definition parameter.h:22
bool hasType() const
Definition parameter.h:23
const QString & canonicalType() const
Definition parameter.h:39
const QString & defaultValue() const
Definition parameter.h:26
This class describes one instance of using the Q_PROPERTY macro.
PureDocParser(const Location &location)
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static void destroyQdocDB()
Destroys the singleton.
static QDocDatabase * qdocDB()
Creates the singleton.
NamespaceNode * primaryTreeRoot()
Returns a pointer to the root node of the primary tree.
void processForest()
This function calls a set of functions for each tree in the forest that has not already been analyzed...
void clearSearchOrder()
void resolveStuff()
Performs several housekeeping tasks prior to generating the documentation.
Status
Specifies the status of the QQmlIncubator.
static void terminate()
Clear the static maps so that subsequent runs don't try to use contents from a previous run.
SourceFileParser(ClangCodeParser &clang_parser, PureDocParser &pure_parser)
Definition text.h:12
static void terminate()
The heap allocated variables are freed here.
static void initialize()
This class constructs and maintains a tree of instances of the subclasses of Node.
Definition tree.h:58
WebXMLGenerator(FileResolver &file_resolver)
#define COMMAND_QMLINHERITS
Definition codeparser.h:58
#define COMMAND_MODULESTATE
Definition codeparser.h:38
#define COMMAND_INTERNAL
Definition codeparser.h:35
#define COMMAND_NONREENTRANT
Definition codeparser.h:42
#define COMMAND_OBSOLETE
Definition codeparser.h:43
#define COMMAND_INMODULE
Definition codeparser.h:32
#define COMMAND_DEPRECATED
Definition codeparser.h:22
#define COMMAND_PRELIMINARY
Definition codeparser.h:46
#define COMMAND_WRAPPER
Definition codeparser.h:87
#define COMMAND_CMAKETARGETITEM
Definition codeparser.h:17
#define COMMAND_REENTRANT
Definition codeparser.h:74
#define COMMAND_STARTPAGE
Definition codeparser.h:80
#define COMMAND_QMLDEFAULT
Definition codeparser.h:55
#define COMMAND_SINCE
Definition codeparser.h:77
#define COMMAND_QMLABSTRACT
Definition codeparser.h:49
#define COMMAND_QTVARIABLE
Definition codeparser.h:73
#define COMMAND_QTCMAKEPACKAGE
Definition codeparser.h:71
#define COMMAND_NOAUTOLIST
Definition codeparser.h:41
#define COMMAND_QTCMAKETARGETITEM
Definition codeparser.h:72
#define COMMAND_DEFAULT
Definition codeparser.h:21
#define COMMAND_THREADSAFE
Definition codeparser.h:81
#define COMMAND_CMAKECOMPONENT
Definition codeparser.h:16
#define COMMAND_QMLREADONLY
Definition codeparser.h:65
#define COMMAND_QMLENUMERATORSFROM
Definition codeparser.h:57
#define COMMAND_INPUBLICGROUP
Definition codeparser.h:33
#define COMMAND_QMLREQUIRED
Definition codeparser.h:66
#define COMMAND_ABSTRACT
Definition codeparser.h:13
#define COMMAND_ATTRIBUTION
Definition codeparser.h:88
#define COMMAND_INQMLMODULE
Definition codeparser.h:34
#define COMMAND_CMAKEPACKAGE
Definition codeparser.h:15
#define COMMAND_INGROUP
Definition codeparser.h:30
#define COMMAND_SUBTITLE
Definition codeparser.h:79
static std::string comparisonCategoryAsString(ComparisonCategory category)
static ComparisonCategory comparisonCategoryFromString(const std::string &string)
#define CONFIG_SOURCES
Definition config.h:448
#define CONFIG_OUTPUTDIR
Definition config.h:429
#define CONFIG_VERSION
Definition config.h:459
#define CONFIG_EXAMPLEDIRS
Definition config.h:391
#define CONFIG_URL
Definition config.h:457
#define CONFIG_INDEXES
Definition config.h:415
#define CONFIG_DEFINES
Definition config.h:385
#define CONFIG_DEPENDS
Definition config.h:386
#define CONFIG_NOLINKERRORS
Definition config.h:428
#define CONFIG_LOGPROGRESS
Definition config.h:420
#define CONFIG_DESCRIPTION
Definition config.h:387
#define CONFIG_IMAGEDIRS
Definition config.h:409
#define CONFIG_PROJECT
Definition config.h:435
#define CONFIG_SOURCEDIRS
Definition config.h:446
#define CONFIG_HEADERS
Definition config.h:400
#define CONFIG_DOCUMENTATIONINHEADERS
Definition config.h:389
#define CONFIG_NAVIGATION
Definition config.h:427
#define CONFIG_LANDINGPAGE
Definition config.h:416
#define CONFIG_OUTPUTFORMATS
Definition config.h:430
#define CONFIG_LANDINGTITLE
Definition config.h:417
#define CONFIG_MODULEHEADER
Definition config.h:425
#define CONFIG_HEADERDIRS
Definition config.h:399
#define CONFIG_INCLUDEPATHS
Definition config.h:411
QList< Doc > DocList
Definition doc.h:96
Q_DECLARE_TYPEINFO(Doc, Q_RELOCATABLE_TYPE)
std::pair< QString, QString > ArgPair
Definition doc.h:27
QList< ArgPair > ArgList
Definition doc.h:28
QMultiMap< QString, QString > QStringMultiMap
Definition doc.h:29
QHash< QString, Macro > QHash_QString_Macro
QT_BEGIN_NAMESPACE typedef QHash< QString, int > QHash_QString_int
NodeType
Definition genustypes.h:154
@ SharedComment
Definition genustypes.h:177
QmlNativeTypeAttribute
Defines QML-specific attributes affecting QmlTypeNode instances.
Definition genustypes.h:203
Metaness
Specifies the kind of function a FunctionNode represents.
Definition genustypes.h:231
@ MacroWithParams
Definition genustypes.h:239
@ MacroWithoutParams
Definition genustypes.h:240
@ QmlSignalHandler
Definition genustypes.h:245
Q_DECLARE_TYPEINFO(Location, Q_COMPLEX_TYPE)
Q_DECLARE_TYPEINFO(Location::StackEntry, Q_RELOCATABLE_TYPE)
constexpr std::size_t MultilineTemplateParamThreshold
Combined button and popup list for selecting options.
This namespace holds QDoc-internal utility methods.
Definition utilities.h:21
bool debugging()
Definition utilities.cpp:39
QMultiMap< QString, CollectionNode * > CNMultiMap
Definition node.h:53
QList< Node * > NodeList
Definition node.h:45
QList< ClassNode * > ClassList
Definition node.h:46
QList< Node * > NodeVector
Definition node.h:47
QMap< QString, NodeMultiMap > NodeMultiMapMap
Definition node.h:51
QMap< QString, Node * > NodeMap
Definition node.h:48
QMap< QString, NodeMap > NodeMapMap
Definition node.h:49
QMap< QString, CollectionNode * > CNMap
Definition node.h:52
QMultiMap< QString, Node * > NodeMultiMap
Definition node.h:50
QList< Parameter > ParameterVector
Definition parameter.h:49
static void generateIndexFile(const Config &config)
Definition main.cpp:308
static void parseSourceFiles(std::vector< QString > &&sources, SourceFileParser &source_file_parser, CppCodeParser &cpp_code_parser)
Definition main.cpp:73
static void singleExecutionMode()
Definition main.cpp:756
void logStartEndMessage(const QLatin1String &startStop, Config &config)
Definition main.cpp:280
static void processQdocconfFile(const QString &fileName)
Processes the qdoc config file fileName.
Definition main.cpp:350
static void clearModuleDependenciesAndProcessQdocconfFile(const QStringList &qdocFiles)
Definition main.cpp:738
static void dualExecutionMode()
Definition main.cpp:773
bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
Definition main.cpp:54
static void loadIndexFiles(const QSet< QString > &formats)
Read some XML indexes containing definitions from other documentation sets.
Definition main.cpp:137
#define QDOC_REFINED_TYPEDEF(_type, _name)
\macro QDOC_REFINED_TYPEDEF(_type, _name)
int main(int argc, char *argv[])
[ctor_close]
@ Deprecated
Definition status.h:12
@ Active
Definition status.h:14
@ Preliminary
Definition status.h:13
@ InternalAuto
Definition status.h:16
@ DontDocument
Definition status.h:17
@ Internal
Definition status.h:15
QHash_QString_Macro macroHash
QHash_QString_int cmdHash
FnCommandParser(QDocDatabase *qdb, const std::set< Config::HeaderFilePath > &all_headers, const QList< QByteArray > &defines, std::optional< std::reference_wrapper< const PCHFile > > pch)
std::variant< Node *, FnMatchError > operator()(const Location &location, const QString &fnSignature, const QString &idTag, QStringList context)
Use clang to parse the function signature from a function command.
QString & version()
Definition importrec.h:29
QString m_importId
Definition importrec.h:19
QString & name()
Definition importrec.h:28
bool isEmpty() const
Definition importrec.h:30
QString m_importUri
Definition importrec.h:18
QString m_moduleName
Definition importrec.h:16
ImportRec(QString name, QString version, QString importUri, QStringView importId)
Definition importrec.h:21
QString m_majorMinorVersion
Definition importrec.h:17
Simple structure used by the Doc and DocParser classes.
Location m_defaultDefLocation
Definition macro.h:20
QMap< QString, QString > m_otherDefs
Definition macro.h:21
int numParams
Definition macro.h:22
QString m_defaultDef
Definition macro.h:19
The Node class is the base class for all the nodes in QDoc's parse tree.
void markInternal()
Sets the node's access to Private and its status to Internal.
Definition node.h:205
virtual void setLogicalModuleInfo(const QStringList &)
If this node is a CollectionNode, this function splits arg on the blank character to get a logical mo...
Definition node.h:259
bool isGenericCollection() const
Returns true if the node type is Collection.
Definition node.h:134
QString fullName() const override
Definition node.h:164
bool isExternalPage() const
Returns true if the node type is ExternalPage.
Definition node.h:100
bool isDontDocument() const
Returns true if this node's status is DontDocument.
Definition node.h:93
virtual QString plainName() const
Returns this node's name member.
Definition node.cpp:484
const Doc & doc() const
Returns a reference to the node's Doc data member.
Definition node.h:237
virtual bool setTitle(const QString &)
Sets the node's title, which is used for the title of the documentation page, if one is generated for...
Definition node.h:202
bool isQmlNode() const
Returns true if this node's Genus value is QML.
Definition node.h:121
virtual void appendGroupName(const QString &)
Definition node.h:195
virtual bool isStatic() const
Returns true if the FunctionNode represents a static function.
Definition node.h:154
virtual QString logicalModuleIdentifier() const
If this is a CollectionNode, this function returns the logical module identifier.
Definition node.h:257
void setHadDoc()
Definition node.h:184
void setUrl(const QString &url)
Sets the node's URL to url, which is the url to the page that the node represents.
Definition node.h:179
virtual bool hasClasses() const
Returns true if this is a CollectionNode and its members list contains class nodes.
Definition node.h:190
virtual bool hasNamespaces() const
Returns true if this is a CollectionNode and its members list contains namespace nodes.
Definition node.h:189
bool isEnumType(Genus g) const
Definition node.h:98
bool isGroup() const
Returns true if the node type is Group.
Definition node.h:105
const QString & reconstitutedBrief() const
Definition node.h:246
void setGenus(Genus t)
Definition node.h:86
virtual bool docMustBeGenerated() const
This function is called to perform a test to decide if the node must have documentation generated.
Definition node.h:197
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...
Definition node.cpp:992
bool isPrivate() const
Returns true if this node's access is Private.
Definition node.h:113
virtual QString signature(Node::SignatureOptions) const
void Node::setGenus(Genus t) Sets this node's Genus to t.
Definition node.h:166
bool isActive() const
Returns true if this node's status is Active.
Definition node.h:89
void setAccess(Access t)
Sets the node's access type to t.
Definition node.h:172
const Location & defLocation() const
Returns the Location where this node's dedefinition was seen.
Definition node.h:232
void setIndexNodeFlag(bool isIndexNode=true)
Sets a flag in this Node that indicates the node was created for something in an index file.
Definition node.h:183
virtual void setQmlModule(CollectionNode *)
If this is a QmlTypeNode, this function sets the QML type's QML module pointer to the CollectionNode ...
Definition node.h:261
virtual QString qmlTypeName() const
If this is a QmlPropertyNode or a FunctionNode representing a QML method, this function returns the q...
Definition node.h:253
virtual bool isAbstract() const
Returns true if the ClassNode or QmlTypeNode is marked abstract.
Definition node.h:137
SharedCommentNode * sharedCommentNode()
Definition node.h:250
bool isNamespace() const
Returns true if the node type is Namespace.
Definition node.h:110
bool isTypedef() const
Returns true if the node type is Typedef.
Definition node.h:128
bool isQmlBasicType() const
Returns true if the node type is QmlBasicType.
Definition node.h:119
virtual QString logicalModuleVersion() const
If this is a CollectionNode, this function returns the logical module version number.
Definition node.h:256
QString nodeTypeString() const
Returns this node's type as a string for use as an attribute value in XML or HTML.
Definition node.cpp:683
ComparisonCategory comparisonCategory() const
Definition node.h:186
virtual void addMember(Node *)
In a CollectionNode, this function adds node to the collection node's members list.
Definition node.h:188
bool hasFileNameBase() const
Returns true if the node's file name base has been set.
Definition node.h:169
bool isPage() const
Returns true if the node type is Page.
Definition node.h:111
virtual QString qmlFullBaseName() const
If this is a QmlTypeNode, this function returns the QML full base name.
Definition node.h:254
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
Definition node.h:123
bool isSharedCommentNode() const
Returns true if the node type is SharedComment.
Definition node.h:126
QString physicalModuleName() const
Definition node.h:212
virtual void setCMakePackage(const QString &)
Definition node.h:216
virtual void setDataType(const QString &)
If this node is a PropertyNode or a QmlPropertyNode, its data type data member is set to dataType.
Definition node.h:193
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
Definition node.cpp:871
bool isHeader() const
Returns true if the node type is HeaderFile.
Definition node.h:106
NodeType nodeType() const override
Returns this node's type.
Definition node.h:82
Genus genus() const override
Returns this node's Genus.
Definition node.h:85
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
Definition node.h:150
void setFileNameBase(const QString &t)
Sets the node's file name base to t.
Definition node.h:170
virtual bool isMacro() const
returns true if either FunctionNode::isMacroWithParams() or FunctionNode::isMacroWithoutParams() retu...
Definition node.h:149
virtual bool isDefault() const
Returns true if the QML property node is marked as default.
Definition node.h:147
bool isEnumType() const
Returns true if the node type is Enum.
Definition node.h:94
virtual Status status() const
Returns the node's status value.
Definition node.h:241
bool isStruct() const
Returns true if the node type is Struct.
Definition node.h:125
bool isConcept() const
Definition node.h:109
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Definition node.h:155
virtual bool isAttached() const
Returns true if the QML property or QML method node is marked as attached.
Definition node.h:144
Aggregate * parent() const
Returns the node's parent pointer.
Definition node.h:210
static bool fromFlagValue(FlagValue fv, bool defaultValue)
Converts the enum fv back to a boolean value.
Definition node.cpp:770
bool isPublic() const
Returns true if this node's access is Public.
Definition node.h:116
bool isVariable() const
Returns true if the node type is Variable.
Definition node.h:133
void setLocation(const Location &t)
Sets the node's declaration location, its definition location, or both, depending on the suffix of th...
Definition node.cpp:912
virtual void setClassNode(ClassNode *)
If this is a QmlTypeNode, this function sets the C++ class node to cn.
Definition node.h:263
virtual ~Node()=default
The default destructor is virtual so any subclass of Node can be deleted by deleting a pointer to Nod...
QString plainFullName(const Node *relative=nullptr) const
Constructs and returns the node's fully qualified name by recursively ascending the parent links and ...
Definition node.cpp:498
virtual bool isDeprecated() const
Returns true if this node's status is Deprecated.
Definition node.h:136
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
Definition node.h:138
FlagValue
A value used in PropertyNode and QmlPropertyNode that can be -1, 0, or +1.
Definition node.h:75
@ FlagValueDefault
Definition node.h:75
@ FlagValueTrue
Definition node.h:75
@ FlagValueFalse
Definition node.h:75
QString qualifyQmlName()
Returns the QML node's qualified name by prepending the logical module name.
Definition node.cpp:982
void setSharedCommentNode(SharedCommentNode *t)
Definition node.h:249
void setTemplateDecl(std::optional< RelaxedTemplateDeclaration > t)
Definition node.h:180
virtual void setRelatedNonmember(bool b)
Sets a flag in the node indicating whether this node is a related nonmember of something.
Definition node.h:187
virtual Node * clone(Aggregate *)
When reimplemented in a subclass, this function creates a clone of this node on the heap and makes th...
Definition node.h:78
virtual void markReadOnly(bool)
If this node is a QmlPropertyNode, then the property's read-only flag is set to flag.
Definition node.h:208
void setComparisonCategory(const ComparisonCategory &category)
Definition node.h:185
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:111
QString qualifyCppName()
Returns the CPP node's qualified name by prepending the namespaces name + "::" if there isw a namespa...
Definition node.cpp:960
ThreadSafeness inheritedThreadSafeness() const
If this node has a parent, the parent's thread safeness value is returned.
Definition node.cpp:860
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
Definition node.h:233
bool isProxyNode() const
Returns true if the node type is Proxy.
Definition node.h:115
virtual bool wasSeen() const
Returns the seen flag data member of this node if it is a NamespaceNode or a CollectionNode.
Definition node.h:194
bool hadDoc() const
Definition node.h:240
const std::optional< RelaxedTemplateDeclaration > & templateDecl() const
Definition node.h:245
Access access() const
Returns the node's Access setting, which can be Public, Protected, or Private.
Definition node.h:230
bool isInternalAuto() const
Definition node.h:90
virtual void setWrapper()
If this node is a ClassNode or a QmlTypeNode, the node's wrapper flag data member is set to true.
Definition node.h:192
virtual QString cmakeComponent() const
Definition node.h:220
bool isFunction(Genus g=Genus::DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
Definition node.h:101
virtual void markDefault()
If this node is a QmlPropertyNode, it is marked as the default property.
Definition node.h:207
ThreadSafeness threadSafeness() const
Returns the thread safeness value for whatever this node represents.
Definition node.cpp:848
virtual QString qtVariable() const
If this node is a CollectionNode, its QT variable is returned.
Definition node.h:215
virtual QString logicalModuleName() const
If this is a CollectionNode, this function returns the logical module name.
Definition node.h:255
Aggregate * root() const
virtual bool isInAPI() const
Returns true if this node is considered to be part of the API as per the InclusionPolicy retrieved fr...
Definition node.cpp:930
virtual bool isFirstClassAggregate() const
Returns true if this Node is an Aggregate but not a ProxyNode.
Definition node.h:139
virtual bool isMarkedReimp() const
Returns true if the FunctionNode is marked as a reimplemented function.
Definition node.h:152
bool isProperty() const
Returns true if the node type is Property.
Definition node.h:114
virtual QString cmakePackage() const
Definition node.h:219
QString fullDocumentName() const
Construct the full document name for this node and return it.
Definition node.cpp:1000
virtual ClassNode * classNode() const
If this is a QmlTypeNode, this function returns the pointer to the C++ ClassNode that this QML type r...
Definition node.h:262
QString url() const
Returns the node's URL, which is the url of the documentation page created for the node or the url of...
Definition node.h:213
bool isTypeAlias() const
Returns true if the node type is Typedef.
Definition node.h:127
virtual Tree * tree() const
Returns a pointer to the Tree this node is in.
Definition node.cpp:902
const Location & declLocation() const
Returns the Location where this node's declaration was seen.
Definition node.h:231
NodeContext createContext() const
Definition node.cpp:175
void setDoc(const Doc &doc, bool replace=false)
Sets this Node's Doc to doc.
Definition node.cpp:560
virtual QString title() const
Returns a string that can be used to print a title in the documentation for whatever this Node is.
Definition node.h:199
virtual void setCMakeComponent(const QString &)
Definition node.h:217
virtual bool setSubtitle(const QString &)
Sets the node's subtitle, which is used for the subtitle of the documentation page,...
Definition node.h:203
bool isModule() const
Returns true if the node type is Module.
Definition node.h:108
virtual bool isAlias() const
Returns true if this QML property is marked as an alias.
Definition node.h:143
virtual QString element() const
If this node is a QmlPropertyNode or a FunctionNode, this function returns the name of the parent nod...
Definition node.h:196
virtual QString subtitle() const
Returns a string that can be used to print a subtitle in the documentation for whatever this Node is.
Definition node.h:200
Node(NodeType type, Aggregate *parent, QString name)
Construct a node with the given type and having the given parent and name.
Definition node.cpp:601
bool isClass() const
Returns true if the node type is Class.
Definition node.h:91
const QString & fileNameBase() const
Returns the node's file name base string, which is built once, when Generator::fileBase() is called a...
Definition node.h:168
virtual bool isPropertyGroup() const
Returns true if the node is a SharedCommentNode for documenting multiple C++ properties or multiple Q...
Definition node.h:153
ThreadSafeness
An unsigned char that specifies the degree of thread-safeness of the element.
Definition node.h:58
@ ThreadSafe
Definition node.h:62
@ NonReentrant
Definition node.h:60
@ UnspecifiedSafeness
Definition node.h:59
@ Reentrant
Definition node.h:61
virtual QString fullTitle() const
Returns a string that can be used as the full title for the documentation of this node.
Definition node.h:201
static QString nodeTypeString(NodeType t)
Returns the node type t as a string for use as an attribute value in XML or HTML.
Definition node.cpp:696
bool isSharingComment() const
This function returns true if the node is sharing a comment with other nodes.
Definition node.h:248
QString fullName(const Node *relative) const
Constructs and returns this node's full name.
Definition node.cpp:544
virtual void setCMakeTargetItem(const QString &)
Definition node.h:218
virtual bool isPureVirtual() const
Definition node.h:118
virtual CollectionNode * logicalModule() const
If this is a QmlTypeNode, a pointer to its QML module is returned, which is a pointer to a Collection...
Definition node.h:260
QString since() const
Returns the node's since string, which can be empty.
Definition node.h:244
virtual void setAbstract(bool)
If this node is a ClassNode or a QmlTypeNode, the node's abstract flag data member is set to b.
Definition node.h:191
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
Definition node.cpp:945
void setParent(Aggregate *n)
Sets the node's parent pointer to n.
Definition node.h:182
static Genus getGenus(NodeType t)
Determines the appropriate Genus value for the NodeType value t and returns that Genus value.
Definition node.cpp:624
bool isPreliminary() const
Returns true if this node's status is Preliminary.
Definition node.h:112
static FlagValue toFlagValue(bool b)
Converts the boolean value b to an enum representation of the boolean type, which includes an enum va...
Definition node.cpp:759
void setReconstitutedBrief(const QString &t)
When reading an index file, this function is called with the reconstituted brief clause t to set the ...
Definition node.h:181
virtual bool hasTag(const QString &) const
If this node is a FunctionNode, the function returns true if the function has the tag t.
Definition node.h:222
virtual QString cmakeTargetItem() const
Definition node.h:221
bool isRelatedNonmember() const
Returns true if this is a related nonmember of something.
Definition node.h:124
void setSince(const QString &since)
Sets the information about the project and version a node was introduced in, unless the version is lo...
Definition node.cpp:800
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
Definition node.h:145
bool isCppNode() const
Returns true if this node's Genus value is CPP.
Definition node.h:92
virtual void setStatus(Status t)
Sets the node's status to t.
Definition node.cpp:574
QString extractClassName(const QString &string) const
Extract a class name from the type string and return it.
Definition node.cpp:820
void setDeprecated(const QString &sinceVersion)
Sets the Node status to Node::Deprecated, unless sinceVersion represents a future version.
Definition node.cpp:1047
virtual bool isRelatableType() const
Returns true if this node is something you can relate things to with the relates command.
Definition node.h:151
virtual bool isCollectionNode() const
Returns true if this is an instance of CollectionNode.
Definition node.h:146
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.
Definition node.cpp:161
void setThreadSafeness(ThreadSafeness t)
Sets the node's thread safeness to t.
Definition node.h:176
void setPhysicalModuleName(const QString &name)
Sets the node's physical module name.
Definition node.h:178
bool isQmlModule() const
Returns true if the node type is QmlModule.
Definition node.h:120
SignatureOption
Definition node.h:65
@ SignatureReturnType
Definition node.h:68
@ SignatureDefaultValues
Definition node.h:67
@ SignaturePlain
Definition node.h:66
@ SignatureTemplateParams
Definition node.h:69
bool isProtected() const
Returns true if this node's access is Protected.
Definition node.h:117
static bool nodeNameOverloadLessThan(const Node *first, const Node *second)
Definition node.cpp:136
bool isExample() const
Returns true if the node type is Example.
Definition node.h:99
QString qualifyWithParentName()
Return the name of this node qualified with the parent name and "::" if there is a parent name.
Definition node.cpp:971
bool isIndexNode() const
Returns true if this node was created from something in an index file.
Definition node.h:107
QString name() const
Returns the node's name data member.
QString plainSignature() const
Constructs and returns the node's fully qualified signature by recursively ascending the parent links...
Definition node.cpp:522
static bool nodeLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Definition node.cpp:79
bool isUnion() const
Returns true if the node type is Union.
Definition node.h:132
const QString & deprecatedSince() const
Definition node.h:225
bool isQmlProperty() const
Returns true if the node type is QmlProperty.
Definition node.h:122
virtual void setQtVariable(const QString &)
If this node is a CollectionNode, its QT variable is set to v.
Definition node.h:214
QByteArray name
QTemporaryDir dir
A class for parsing and managing a function parameter list.
Definition main.cpp:28
Parameter & operator[](int index)
Definition parameters.h:39
const ParameterVector & parameters() const
Definition parameters.h:30
bool isEmpty() const
Definition parameters.h:32
void append(const QString &type)
Definition parameters.h:42
void pop_back()
Definition parameters.h:43
QSet< QString > getNames() const
Insert all the parameter names into names.
bool match(const Parameters &parameters) const
Returns true if parameters contains the same parameter signature as this.
void reserve(int count)
Definition parameters.h:35
Parameters(const QString &signature)
QString rawSignature(bool names=false, bool values=false) const
Returns the signature of all the parameters with all the spaces and commas removed.
QString generateNameList() const
Construct a list of just the parameter names (without types) and return it.
QString generateTypeList() const
Construct a list of the parameter types and return it.
bool isValid() const
Definition parameters.h:33
void clear()
Definition parameters.h:24
Parameter & last()
Definition parameters.h:37
bool isPrivateSignal() const
Definition parameters.h:31
const Parameter & at(int i) const
Definition parameters.h:36
void append(const QString &type, const QString &name)
Definition parameters.h:41
QString signature(bool includeValues=false) const
Returns the list of reconstructed parameters.
const Parameter & last() const
Definition parameters.h:38
int count() const
Definition parameters.h:34
QString generateTypeAndNameList() const
Construct a list of the parameter type/name pairs and return it.
void append(const QString &type, const QString &name, const QString &value)
Append a Parameter constructed from type, name, and value to the parameter vector.
void set(const QString &signature)
Parse the parameter signature by splitting the string, and store the individual parameters in the par...
void setPrivateSignal()
Definition parameters.h:44
Processes parser errors and outputs warnings for them.
Definition parsererror.h:20
A struct for indicating that a ClassNode is related in some way to another ClassNode.
Access m_access
ClassNode * m_node
RelatedClass(Access access, ClassNode *node)
This is the constructor used when the related class has been resolved.
RelatedClass(Access access, QStringList path)
RelatedClass()=default
The default constructor does nothing.
QStringList m_path
bool isPrivate() const
Returns true if this RelatedClass is marked as Access::Private.
QSet< QString > parameterNames() const
Returns the set of all declared template parameter names.
QSet< QString > requiredParameterNamesForFunctions() const
Returns the set of template parameter names that are API-significant and should be documented for fun...
std::optional< std::string > requires_clause
std::vector< std::string > referenced_concepts
std::string to_std_string_for_rendering() const
Returns a string representation that excludes SFINAE-annotated parameters.
std::size_t visibleParameterCount() const
Returns the number of template parameters that are visible in rendered output — SFINAE-annotated para...
std::optional< std::string > concept_name
ValuedDeclaration valued_declaration
std::optional< SfinaeConstraint > sfinae_constraint
std::optional< TemplateDeclarationStorage > template_declaration
std::string to_std_string() const
Represents a file that is reachable by QDoc based on its current configuration.
const QString & get_path() const
Returns a string representing the canonicalized path to the file that was resolved.
ResolvedFile(QString query, FilePath filepath)
Constructs an instance of this type from query and filepath.
const QString & get_query() const
Returns a string representing the user-inputted path that was used to resolve the file.
Holds the source-level alias with its template arguments for a SFINAE constraint detected in a non-ty...
std::vector< RelaxedTemplateParameter > parameters
Definition topic.h:9
QString m_topic
Definition topic.h:22
Topic(QString &t, QString a)
Definition topic.h:12
Topic()=default
QString m_args
Definition topic.h:23
~Topic()=default
bool isEmpty() const
Definition topic.h:15
void clear()
Definition topic.h:16
QStringList context
Definition codeparser.h:100
std::string to_std_string(PrintingPolicy policy=default_printing_policy()) const
static PrintingPolicy default_printing_policy()
bool are_template_declarations_substitutable(const TemplateDeclarationStorage &left, const TemplateDeclarationStorage &right)
QList< Topic > TopicList
Definition topic.h:25