summaryrefslogtreecommitdiff
path: root/src/qdoc/text.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QDoc: Move QDoc source files under a further "qdoc" directoryLuca Di Sera2023-04-121-306/+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: Fix clang warnings about temporary QRegularExpression objectsFriedemann Kleint2022-12-021-1/+2
| | | | | | | Pick-to: 6.4 Change-Id: I0d6c597552103251a8c09418d83ea2e38ed10012 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Luca Di Sera <luca.disera@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: Add an option to inspect the intermediate Atom representationLuca Di Sera2021-11-031-2/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Text::operator<<()Paul Wicking2021-05-201-1/+1
| | | | | | | | | | | | | | Add a check to Text::operator<<() to stops QDoc from outputting unnecessary "empty" spans, i.e. <span class="subtitle"></span> when generating html. Task-number: QTBUG-81209 Task-number: QTBUG-73026 Change-Id: I4df7875ee1c29bc1d48e9c3e53e8ce0518f3be3e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Code cleanupPaul Wicking2021-05-191-34/+34
| | | | | | | | | | | | | * 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>
* QDoc: Code cleanupPaul Wicking2021-05-031-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: Remove unused method from AtomPaul Wicking2020-09-291-14/+0
| | | | | Change-Id: I74906ff5c786ff7f7a7612845cf4204c5de8e31d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Port qdoc to QRegularExpressionLars Knoll2020-05-181-2/+2
| | | | | Change-Id: I2c9eb349a92503afcdd41bacf556e561d9f8c098 Reviewed-by: Liang Qi <liang.qi@qt.io>
* QDoc: Clean up includesPaul Wicking2020-05-041-1/+1
| | | | | | | | | * Remove unused includes * Replace deprecated C++ includes with counterpart. Task-number: QTBUG-71176 Change-Id: Ie3224d9f9c19fd8f93879de6c7604a8db421b88b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* clang-format QDocPaul Wicking2019-12-171-25/+16
| | | | | | | | | | | | | | | | 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: Clean up whitespacePaul Wicking2019-08-081-25/+25
| | | | | | | | | | | Ensure that QDoc conforms to Qt style, whitespace edition. For the most part, the change involves moving the pointer operators. Also remove whitespace following an opening parenthesis, or immediately preceding a closing one. In some cases, adjust the following line accordingly in methods that span multiple lines. Change-Id: I56ae125a2acf09c669c0a73dc814d05f13575f39 Reviewed-by: Martin Smith <martin.smith@qt.io>
* QDoc: Ensure all includes are uniform and according to stylePaul Wicking2019-08-031-2/+4
| | | | | | | | | | | | | | | | | | | Housekeeping. Includes are organized after recommended best practice and organized in the following order: - include self (i.e. include own header) - include local files - include Qt, e.g. <QtCore/qstring.h> - include Qt private - include externals, e.g. stdio.h in alphabetic order within each block, aside from accommodating #if-ery, in which includes follow the block they belong to. Also, updated copyright notice to year of latest edit in each file. Change-Id: I1e6b215f172fd5373d57016f7678b88b9e73231e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDoc: Code cleanup, use nullptr for nullptr constantsPaul Wicking2019-02-081-34/+34
| | | | | | | | | | Replace 0 as nullptr constant with nullptr. Remove reduntant semi-colons after member function definitions. Adjust whitespace on lines otherwise touched. Change-Id: I6af218ca8377611040360e0a3da392e7cffd29e9 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add a Text::contains() method for use by QDocMartin Smith2019-01-221-0/+17
| | | | | Change-Id: I051a594500b125d5054bf49e33964b7097dbac13 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove Atom::GuidLink as it is no longer in useMartin Smith2019-01-221-3/+2
| | | | | | | | | The only place it was used was in a check for it being an Atom's type; but no Atom was ever created with this as its type. Change-Id: If66d5cf07a987defd43ef0927d3a3f249d4c3fe0 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Updated license headers and license testsAntti Kokko2016-06-101-17/+12
| | | | | | | | | | | | | From Qt 5.7 -> tools & applications are licensed under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) License header tests also updated to match current headers. Change-Id: Ia6bdacaa3c5bbc9d31334e1a0cabfe502a484dc4 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* move qdoc back to qttoolsOswald Buddenhagen2015-10-231-0/+300
we can do that now, as the bootstrap lib is now a properly exported module, and qmldevtools is now bootstrapped as well. this removes the abomination of a copy of the qml parser in qtbase. unfortunately qtbase/2422251ee5025a067b14b989153764ab36e43f10 is reverted, as qtdeclarative is still missing the respective change. this introduces no regression in discoverability or usability, as a full doc build already needed qttools - for qhelpgenerator. Change-Id: Ic9c4c9732ddf5998637b9e42e27939ba50b31479 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>