summaryrefslogtreecommitdiff
path: root/src/qdoc/doc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QDoc: Move QDoc source files under a further "qdoc" directoryLuca Di Sera2023-04-121-466/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc development under the "qttools" repository is currently performed under the "src/qdoc" directory, which contains all source files and directories relevant to QDoc as direct children. Due to a slow restructuring of how QDoc works, what its dependencies are and certain possible architectural changes, the infrastructure that is expected to be required for the development of QDoc might increase. Some of that infrastructure, which might require some custom effort, is expected to be developed as "independent" "library-like" sub-projects, which QDoc depends on. Albeit developed "independently", such infrastructure would be developed specifically for QDoc and thus should live "adjacent" to it. To allow such a structure a new "qdoc" directory was added under the "src/qdoc" directory. All source files and directory that were previously children of the "src/qdoc" directory were moved under the new "qdoc" directory. This preserves the space for QDoc-related elements and the relative project structure while allowing some space for "adjacent" projects that are intended for QDoc specifically. To support the change, a new "CMakeLists.txt" file was introduced under "src/qdoc", which dispatches to the "CMakeLists.txt" file in the new "src/qdoc/qdoc" directory. QDoc is only built when certain dependencies are found. This is supported through the use of Qt features at the CMake level. The "CMakeLists.txt" file in "src", thus dispatched to the "src/qdoc" directory only when the required features were found. As "independent", "library-like", entities might not have the same requirements as QDoc, the "CMakeLists.txt" file in "src" was modified to always dispatch to the "src/qdoc" directory while the features-check was moved to the new "CMakeLists.txt" files in "src/qdoc", so as to allow non-QDoc but QDoc-specific project to have an independent configuration for building. Certain test projects in "test/auto/qdoc/" depends on QDoc-specific source-files to generate their CMake targets. Those dependencies were generally specified as relative paths. The additional level in the directory structure invalidated the paths and, hence, the relevant "CMakeLists.txt" files for those projects were modified to correctly refer to the new directory structure. Change-Id: I50c7106614428753544eaba5091e1e44d48fd31d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: remove DocParser::terminate() (noop)Paul Wicking2023-03-031-1/+0
| | | | | | | | | | Since dropping support for QDoc's alias configuration variable, DocParser::terminate() is a noop. Drop the method. Task-number: QTBUG-111670 Change-Id: Ic9f1e44d3d87a7c13353dc2538735003febf6484 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Drop support for renaming commands via qdocconf filesPaul Wicking2023-03-031-21/+0
| | | | | | | | | | | | | | | | | | | | For "compatibility reasons", support for renaming commands through an "alias" defined in a .qdocconf-file was introduced to QDoc. In particular, this was an aid when renaming QDoc's \input command to \include. This usage has since been unified in Qt, with the exception of in QDoc's own documentation project, and the more powerful \macro command can be exercised to achieve the same behavior. This feature's implementation obstructs efforts to make QDoc's code more thread safe. As there are no known usecases, remove support for renaming commands to pave the way for a more performant QDoc. [ChangeLog][QDoc] Support for the 'alias' variable in qdocconf-files is removed. Use QDoc's 'macro' construct instead. Fixes: QTBUG-111670 Change-Id: Ifcf8a47ee1e1940607cec4841e6ba06b493e6d24 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Remove Config::lastLocation()Topi Reinio2023-03-021-11/+13
| | | | | | | | | | | | | | | | | | | Config stored an internal Location, used for error reporting. This location instance was updated whenever a config variable was queried. This prevented parallelization of code that accesses Config via the singleton instance. Remove Config::lastLocation, and move functions that return a configuration variable as a string, string list, boolean, etc. to ConfigVar itself. Keep existing access functions in Config as simple wrappers. Provide Config::get() that returns a reference to ConfigVar, and provide location info via ConfigVar::location(). This allows call sites to get location info for a configuration variable on demand. Change-Id: I72c6f5cec699e44aa2f3164e6019a04adbd1ab07 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* qdoc: Fix various clang warningsFriedemann Kleint2022-12-021-3/+6
| | | | | | | | | | | | - remove unused variables - Use QString::arg() with multiple string arguments - Avoid detaching containers in loops Pick-to: 6.4 Change-Id: I9b29f5a0269f288b7de862eccdcee9750248dce8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* qdoc: Attempt to read macro arguments only onceTopi Reinio2022-11-101-1/+2
| | | | | | | | | | | | | | | | | | | | | QDoc supports multiple versions of macros, one for each supported output format: macro.hello.HTML = "<p>Hi, \1</p>" macro.hello.DocBook = "<db:para>Hi, \1</db:para>" Macros can also take arguments. However, with multiple format-specific versions defined, QDoc attempted to also read the arguments multiple times. This fails on the second attempt as the internal position has been already advanced beyond the arguments. Implement a new helper function, DocParser::getMacroArguments(), and use it to read the arguments only once. Fixes: QTBUG-108219 Pick-to: 6.2 6.4 Change-Id: Icad7e51b93c00a2632746ea2fe05d36459b9acda Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: I95f6410e57a6a92b1cf91bbedfbe3d517cab6b44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-191-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I5335388c0472b0ee554234fc7eca60769e504660 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QDoc: Apply the FileResolver abstraction to the codeLuca Di Sera2022-05-101-37/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recently added `FileResolver` abstraction encapsulate the logic that QDoc uses for finding user-provided files in the documentation that QDoc will need to interface with. Previously, this process was mostly contained in `Doc::resolve_file`. This was considered problematic as `Doc` is an extremely complex class with many responsibilities, coupling the logic with many unrequired preconditions and making testing of this simple logic almost unattainable. Furthermore, a similar logic in QDoc was provided by `Config::findFile`, which was sometimes used instead of `Doc::resolveFile`, fracturing the behavior of the code. To avoid those issues, allow for the testing of the logic for file resolution and to generally simplify the code and make it more consistent, `Doc::resolveFile` was removed and substituted with the `FileResolver` abstraction. A few changes were made to support this new idiom. - An instance of `FileResolver` is now built in `processQdocconfFile` and passed as a reference to systems that require it during construction. A small exception was made for `DocParser` where the instance is passed as a pointer through `DocParser::initialize` to support the current code structure. The required changes to the relevant entities constructors were made to allow for this. - `FileResolver` is provided as an explicit dependency to anything that requires the capability of resolving files, such as generators. Generally during construction. This is intended as a first step in removing the intitialize-terminate idiom, reducing the scope of some of the mutable state and increasing the expliciteness of its provenance. To allow for this, the main routing of QDoc was modified to construct the Generators classes during the production of the documentation in `processQdocconfFile`. This was required as an initialized `FileResolver` is needed for the generators to work. As `FileResolver` instead depends on a parsed configuration, it was not possible anymore to construct the generator once before doing anything else. A small defensive addition to `Generator::terminate` was added, removing all generators from the list of generators. This should not actually be required, but it was added to ensure that the now more limited scope of the generators and the possibility that they would be constructed more than once would not collide with their broader, unrequired global scope. - To take into account the simplified data requirements for `FileResolver`, compared to the previous logic, such the usage of a single list of directories, the extraction of relevant values from the configuration in `processQdocconfFile` was modified to further mold the data into a suitable format for `FileResolver`. - As the data is relevant to searching directories is contained within the `FileResolver` instance that underlying systems use and does not require any processing to be retrieved, some of the caching members in, for example, `Generator` that contained a reference to this data were removed. See, for example, `Generator::s_exampleDirs`. As a consequence of all those changes, `Generator::augmentImageDirs` and `Generator::setImageFileExtensions` were removed as unused. - `Generator::generateExampleFilePage`, was modified from having two overload to a single method with a default argument to reduce the bloat. - `Generator::addImageToCopy` was modified to use a `ResolvedFile`. The method copies an image from the examples to the output directory. This should be done only when the image is available. - Places where `Doc::resolveFile` were called were modified to use `FileResolver::resolve`. Due to this change some underlying methods were modified to require a `ResolvedFile`. `Doc::resolveFile` was removed as a consequence. - `Doc::quoteFromFile`, which previously depended on `Doc::ResolveFile`, was modified to require a `ResolvedFile`. This lightens the responsibility of the method to quoting only, instead of finding the file and quoting, ensuring that it is called only when the quoting can actually happen. Furthermore, it removes the need for some of the error reporting which is bubbled up to the caller during file resolution. This was further required to avoid having `Doc` require a `FileResolver` instance, as `Doc`'s constructor is called in many places. - The usage of a `userFriendlyFilePath` was removed from code using `Config::findFile`. A run of QDoc on the current documentation shows that `userFrinedlyFilePath` is always equal to the original path that was passed to find file except in two cases where `userFriendlyFilePath` would be null. Consumer code didn't seem to make any use of the null state of the `userFriendlyFilePath` and ignoring it doesn't seem to change the output documentation, such that it was considered safe to avoid. It is currently unclear what the original purpose of this element was. As `Doc::resolveFile` implicitly used `Config::findFile` and exposed back the `userFriendlyFilePath`, this is true for all replaced usages of the method too, which allowed ignoring the element in the first place. - A now unused overload of `Config::findFile` taking a series of extensions for the searched for file was removed. - `Config::copyFile` was modified to remove some of the processing done to its input parameters which is now unused. A simplified version of it was retained to handle a known case that is actually used by the code. - `DocParser` was modified to internally make use of `FileResolver` for when resolving files for quoting and some code handling. It previously used a mix of `Doc::quoteFromFile` and its internal `quoteFromFile`. The usages were made consistent depending only on the internal `quoteFromFile`. `quoteFromFile` itself was further changed to take into account the changes in `Doc::quoteFromFile`, now resolving the file itself. - Some of the code was littered with TODO and REMARK comments to keep track of things that were noticed during the change that will not be addressed at this point in time. Change-Id: Ifb2e03696f6de64dac54470f7a969d323a88c0a7 Task-number: QTBUG-100381 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Replace uses of deprecated _qs with _sSona Kurazyan2022-04-201-2/+4
| | | | | | Task-number: QTBUG-101408 Change-Id: If6f25418bf3af66ad9bde2dba8bf529b8d202f83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QDoc: Add an option to inspect the intermediate Atom representationLuca Di Sera2021-11-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QDoc parses a block-comment, it produces an intermediate representation of `Atom` types that is later used as the processing base to generate the required output. To ease the process of inspecting this representation for debugging or learning purposes, a new command-line-option, `atoms-dump`, was added. When `atoms-dump` is passed as an argument, QDoc will print a human-readable `Atom`s structure for each block-comment that is parsed during its execution. The information is printed in `Doc::Doc`, the only call location for `DocParser::parse`, along with information about the starting and ending location of the relevant block-comment. A previously unused function, `Text::dump`, centralizes the logic of generating a human-readable form and the action of outputting it. `Text::dump` was slightly modified to emphasize the relation between consecutive atoms enclosed in a block-like structure, such as those between a `ParaLeft` and `ParaRight` atom. An unused function, `Atom::dump`, was removed. The function duplicated parts of the code of `Text::dump`, but for a single atom. To avoid spreading the surface of side-effecting functions and to avoid splitting the responsibility of formatting atoms in a human-readable-form, the function was not used as part of `Text::dump` and was, hence, removed as superfluous instead. Fixes: QTBUG-97775 Change-Id: If2933139575f97640e87f27c8ab1dbcbf7d14171 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Improve function tagging for grouped \fn commandsTopi Reinio2021-08-231-11/+14
| | | | | | | | | | | | | | | | | | | QDoc provides a mechanism for tagging specific function declarations in a header with //! [tag] comments, allowing these tags to be referenced in an \fn command. This feature did not work for shared comment nodes containing multiple \fn commands, however. To make this work, we need to associate the 'bracketed args' (where the id tag is) with the command itself - previously it was stored in the Doc instance, but that doesn't work when there are multiple topic commands sharing a doc. To do so, repurpose the ArgLocPair structure to store the bracketed arg instead of a Location, as we never used this particular Location for anything, anyway. Pick-to: 6.2 Fixes: QTBUG-95948 Change-Id: Ic899d4252d705f84ba56ea201a55f3e5db068f00 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Code cleanupPaul Wicking2021-05-191-56/+57
| | | | | | | | | | | | | * Unify members; use s_ or m_ prefix instead of _ suffix. * Remove unnecessary member that duplicates content in base class. * Add [[nodiscard]] annotations where applicable. * Add overloads to virtual methods that have been extended with parameters with default values. * Make single argument ctors explicit. * Remove semi-colon from namespace declaration. Change-Id: Ie1ff39079722b81ba6754f945a898dc9b335bbae Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Improve \deprecated commandPaul Wicking2021-05-101-0/+11
| | | | | | | | | | | | | | | | | | | | | | This change allows users to specify an optional parameter to the \deprecated command to record which version something was deprecated. It also allows for free text descriptions. These descriptions become the first paragraph of the resulting documentation. Usage: \deprecated \deprecated [6.2] \deprecated [6.2] Use QFoo() instead. \deprecated Use QFoo() instead. [ChangeLog][qdoc] QDoc now lets you record the version something is deprecated and suggest replacements with the \deprecated command. Task-number: QTBUG-58249 Change-Id: I27081627132b2f8ea3dd7d48ded8e37213366074 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Code cleanupPaul Wicking2021-05-031-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use multiple arguments for QStrings instead of calling .arg() multiple times. * Define trivial constructor/destructor '= default' instead of adding empty implementations. * Remove unreachable code. * Prefer ranged-based for loops. * Initialize with auto from static_cast<>() and new. * Simplify expressions. * Prefer "QList::empty()" over "QList::size() > 0". * Remove unused method. * Return qsizetype instead of int to avoid narrowing conversion. * Remove unused include. * Remove unreachable return statement. * Prefer raw string literals over escaped regexes. * Initialize struct members. * Make variables used as const refs const refs. * Use std::move instead of passing const ref in ctor. * Drop redundant 'virtual' from methods marked 'override'. * Make local copies that arent ever modified const refs to avoid copying. * Turn for-loop into std::any_of. * Made single-argument constructor explicit. * Don't shadow variable names from outer scope if not necessary. * Remove const at top level that does not improve const correctness. * Update copyright notice for affected classes. Task-number: QTBUG-71176 Change-Id: Ia41e5b947b72f594b60d189b6b0ff68587c3afb9 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Use QList instead of QVectorJarek Kobus2020-06-091-6/+6
| | | | | | | | Task-number: QTBUG-84469 Change-Id: I88b99ba7f5648d9da7878b7f7723f48cd86be2ac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract QmlTypeNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: Ia3a0010e9791b69ca73d12a1e98322477e1569aa Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Drop half-baked translation effortPaul Wicking2020-06-041-9/+11
| | | | | | | | | | | | | | The current implementation suffers from lack of maintenance. This causes a poor user experience that adds little value, or is even detrimental to perceived value. Work to improve the situation would have to be done at the expense of something else. This patch removes the Q_DECLARE_TR_FUNCTIONS macros from QDoc, and replaces calls to tr() with QStringLiteral(). Fixes: QTBUG-84568 Change-Id: I2df71c27246ca5de816608c887cf359db8f85900 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract DocParser from doc.cppPaul Wicking2020-05-191-2573/+3
| | | | | | | | | | The bulk of Doc's implementation file is the DocParser class. Extract this class to reduce the size and complexity of Doc, to improve testability of both classes. Fixes: QTBUG-84004 Change-Id: I44cc1ff50aaa7a29c06773761ed3860e1582926e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Replace Q_GLOBAL_STATICs with singleton objectPaul Wicking2020-05-191-18/+18
| | | | | | | | | Provide access through a singleton object so that access can be obtained by including a header. Break dependency on code location. Task-number: QTBUG-84004 Change-Id: I0c66c8d6e5e4d1b8e40a83053c274518469f1285 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Add DocUtilitiesPaul Wicking2020-05-191-3/+0
| | | | | | | | | | Collect common typedefs and globals in a single entity to allow for easier refactoring of contents in doc.cpp. Task-number: QTBUG-84004 Change-Id: Id51edb98426e759bda55114820e7025a5281b603 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Port qdoc to QRegularExpressionLars Knoll2020-05-181-14/+16
| | | | | Change-Id: I2c9eb349a92503afcdd41bacf556e561d9f8c098 Reviewed-by: Liang Qi <liang.qi@qt.io>
* QDoc: Get rid of Q_GLOBAL_STATICs in doc.cppPaul Wicking2020-05-071-20/+14
| | | | | | | | | | | | Drop the Q_GLOBAL_STATIC and return QSet<QString> on the stack if we don't already have one. Do not return const-ref as the QSet is implicitly shared anyway. const-qualify a receiving container. Task-number: QTBUG-84004 Change-Id: I8e06eb32f6ba82aeae1b727c777c5118c1f1d24f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract structs from docPaul Wicking2020-05-071-8/+1
| | | | | | | | | | The Macro struct is used by the Doc and DocParser classes. Extract it so that it may be included by the classes that need it. Also extract Topic and a related typedef for the same reason. Task-number: QTBUG-84004 Change-Id: Ia6b277c392f32d9f8a92af966acc7762abc54f04 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract DocPrivate class from DocPaul Wicking2020-05-071-106/+1
| | | | | | | Task-number: QTBUG-84004 Change-Id: I498194c384185aa08dde28d605a342b8eba25c76 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Simplify a couple of loopsPaul Wicking2020-05-071-16/+15
| | | | | | | | Prefer ranged-based for; improve variable names. Task-number: QTBUG-84004 Change-Id: I2785ebe6d7236d14fd8bc649392c9dd7fb9254f5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove unused code in DocParserPaul Wicking2020-05-071-17/+0
| | | | | | Task-number: QTBUG-84004 Change-Id: I5de4cd1103a02bb40a8b01a0825ece6e01d49c19 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Initialize member not initialized by ctorPaul Wicking2020-05-071-17/+17
| | | | | | Task-number: QTBUG-84004 Change-Id: Id9d80d2afb309b5873f7188905c13c975fe819bf Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract DITA classes from Doc (cleanup/refactor)Paul Wicking2020-05-051-9/+1
| | | | | | | | | | | Most of the DITA related code has already been pulled out of QDoc. Separate the Dita-specific classes from Doc to remove clutter and ease further removal efforts. Task-number: QTBUG-71176 Fixes: QTBUG-83930 Change-Id: I56ff148bb01d0edf1a9dce3b181a916c4ec20e88 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Clean up includesPaul Wicking2020-05-041-3/+2
| | | | | | | | | * Remove unused includes * Replace deprecated C++ includes with counterpart. Task-number: QTBUG-71176 Change-Id: Ie3224d9f9c19fd8f93879de6c7604a8db421b88b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove unused codePaul Wicking2020-04-301-60/+0
| | | | | | | | | | Drop code that is unused in QDoc (YAGNI). If we decide to make use of this code in the future, we can always revive it. Task-number: QTBUG-71176 Change-Id: I1486bc01a2795453587d4025f031bc4eb941a911 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Ensure macros as a macro parameter are expandedTopi Reinio2020-03-261-1/+1
| | | | | | | | | | QDoc allows macros to be nested, and macro parameters can also be other macros, but in one code path the parameter was read verbatim, i.e. not expanded. This is an unnecessary restriction so remove it. Fixes: QTBUG-83085 Change-Id: I6dc7c2f7586a65bee78096fb50685262dad2ffe3 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-021-1/+1
| | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I7137cf8339bfe9fdcf4cb7cc695cb146aef410fb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qdoc: Parse arguments for an \obsolete commandTopi Reinio2020-02-281-0/+6
| | | | | | | | | | | | | | | | | The command was documented as taking no arguments, and any arguments were ignored. The documentation still has many instances of \obsolete Use somethingElse() instead. Where the description was lost. Force a linebreak after the command, allowing any arguments to be processed as a normal text paragraph. [ChangeLog][qdoc] Generate output for arguments passed to the \obsolete command. Fixes: QTBUG-82558 Change-Id: If3e39382367a0c1f4cc63a2c322e986e053ecd6b Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* qdoc: Fix warning when accessing a QString outside of its rangeAndy Shaw2020-02-261-2/+2
| | | | | | | | | | | | | | Since skipSpacesOnLine() can end up making pos == len then we need to check pos is less than length before querying input_ with that position. This fixes the warning "Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt." Fixes: QTBUG-80346 Change-Id: Ica1c57f616c3efaefd597ebb84e52b17325d22fa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-181-1/+1
| | | | | Change-Id: I98eaf748fdfb34f32d187718459327b8eef9c54b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Format according to stylePaul Wicking2020-02-141-1/+1
| | | | | | | Run clang-format across QDoc, this is the result. Change-Id: Iaabad0a07a0495990013cbf5995c65db531a7d0d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Make Config a singletonTopi Reinio2020-01-131-5/+3
| | | | | | | | | | | | There is no need to pass a pointer to Config throughout the API; the only instance of it is created in main() so we can turn it into a singleton. Having access to Config without API changes makes implementation of configurable features easier. Change-Id: Ida47e067865082dfe036a7a97f7f1ffc736db346 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: clean up ctor/dtor in AtomPaul Wicking2020-01-061-2/+2
| | | | | | | | | | | * Make calling code specify Atom type, remove superfluous ctor. * Move default initialization from initialization list to in-class for member that initializes the same in all ctors. * Move initialization from ctor body to initialization list. * Mark trivial dtor default. Change-Id: I5e4a9e5cdcf0b9f3ba68b53dcab34c2ab77b415d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Fix whitespace (again)Paul Wicking2020-01-061-5/+3
| | | | | | | | | Whitespace that got reintroduced from an old patch that integrated late. Fix it separately to avoid mixing with other changes. Change-Id: I6e905cd5710a31c671702a6ad9f5711b251e1020 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Introduce ignorewords configuration variableTopi Reinio2019-12-181-102/+76
| | | | | | | | | | | | | | | | | | QDoc automatically generates hyperlinks for words that qualify for auto-linking. This may become a problem whenever there is a qualified word as a section or a page title, and that word appear in the documentation frequently. For example, 'macOS' is mentioned often and each occurrence is linked, which is unnecessary and sometimes confusing. Provide a way to exclude specified words from being auto-linked. Create a new helper function, DocParser::isAutoLinkString(), to determine whether a string qualifies, and replace duplicated code with calls to that function. Fixes: QTBUG-79135 Change-Id: Ie53fe7ca0692f7b8e10a5f2208df5cd2ee2aab1d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* clang-format QDocPaul Wicking2019-12-171-470/+357
| | | | | | | | | | | | | | | | This patch is the result of formatting all of QDoc's source with clang-format. The clang-format style is from the qt5 super repo's _clang-format definition. The purpose is unify the style across the code, to avoid spending too much time on style related issues in reviews and cleanup patches. Future changes to QDoc can benefit from using git-clang-format in combination with the git commit hook provided in qtrepotools.git as mentioned in this email to the dev list: https://lists.qt-project.org/pipermail/development/2019-October/037682.html Change-Id: I8af6a051c8334b5f35862a4dcd3becce8ac500c2 Reviewed-by: Martin Smith <martin.smith@qt.io>
* QDoc: Use QVector instead of QListPaul Wicking2019-12-121-10/+10
| | | | | | | | | | | Replace the use of QVector in most of QDoc. Also, remove one redundant C-style cast to int for result from method call that returns an int. As this happened in a macro, the result is removing a whole bunch of nagging from code inspection. Fixes: QTBUG-80669 Change-Id: Ib1aed95e01eaddd1e1213a145e815a0c4753ac67 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDoc: Minor adjustment/cleanupPaul Wicking2019-12-111-42/+42
| | | | | | | Pre-increment instead of post-increment for efficiency and readability. Change-Id: I10b33360dd36cd1d0f4338441c1ad4724551e80e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Get rid of unnecessary castsPaul Wicking2019-12-111-8/+8
| | | | | | | Drop casting ints to int. Change-Id: I571f3e245bfc97a7c0c7bea5bedbf0ed5ab04c60 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Clean up loops with iteratorsPaul Wicking2019-12-101-20/+14
| | | | | | | | | | | - Use ranged-based fors where applicable. - Use auto keyword for iterators. - Move a few variable declarations to where they're to be used. - Update docs where applicable. Fixes: QTBUG-80536 Change-Id: I859440b96428dec4ef108b01d391479d3f8dbd83 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Minor cleanup in doc.cppPaul Wicking2019-12-041-1/+1
| | | | | | | | Improve readability by pre-incrementing instead of post-incrementing. This should also improve performance slightly. Change-Id: Icec66867dfdb04a65e3fe3229d21e2cda98eebb9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDoc: Use range-based for instead of foreachPaul Wicking2019-09-281-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces the use of foreach with range-based for throughout QDoc. It also ensures that the loop body doesn't modify the container being iterated over, by: - Making a const copy when the container is a member variable or the result of an expression, and iterating over that copy. This is the preferred approach. - Using qAsConst() when the container is a (static) member variable or local to the method and not const. The latter is typical where the collection is sorted immediately before the loop. In two cases (doc.cpp), replaced Q_FOREACH + delete with qDeleteAll. In two cases (cppcodeparser.cpp), the range declaration is replaced within the loop statement. These rewrites express the behavior clearer than the original code. In two cases (codeparser.cpp), use a range-based for instead of a while loop where the condition is an iterator, for more expressive code. Finally, use the auto keyword where appropriate and improve a few variable names. QDoc warning count and generated output is unchanged after this refactoring. Change-Id: I64f02d24dca373a3a41402d535382e2c526bb55e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDoc: Fix some more whitespacePaul Wicking2019-09-271-2/+2
| | | | | Change-Id: I0d95efceff54a8b7f54ed5e79275f9de1a43b68b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Get rid of old #if 0 blocksPaul Wicking2019-08-161-7/+0
| | | | | | | | | | Most of these have remained unchanged since 2015, so it seems it is simply not needed. In any case, these lines of code are all contained in the git history. Change-Id: I1bda6bc0aad61d59ec2f83de31d29e17d5255b71 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>