summaryrefslogtreecommitdiffstats
path: root/src/qdoc/tree.h
Commit message (Collapse)AuthorAgeFilesLines
* clang-format QDocPaul Wicking2019-12-171-47/+33
| | | | | | | | | | | | | | | | 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>
* Change spaces to follow coding rulesThibaut Cuvelier2019-11-131-5/+5
| | | | | Change-Id: I81de861e9daa00249c47ddbe259f43f47d7c6615 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Get rid of old #if 0 blocksPaul Wicking2019-08-161-6/+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>
* QDoc: Clean up whitespacePaul Wicking2019-08-081-90/+90
| | | | | | | | | | | 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/+3
| | | | | | | | | | | | | | | | | | | 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: Fix "Inherited By" outputMartin Smith2019-07-311-3/+4
| | | | | | | | | | | | | | | | | The "Inherited By" list was incomplete for QObject (and other classes) because classes that inherited QObject from modules outside QtBase were not being included. This update cleans up the maintenance of a class's base class and derived class information so that the "Inherited By" list is more correct. Note that the "Inherited By" list can't be guaranteed to be complete because, for example, classes in external modules might inherit QObject, but if those external modules are not listed as dependencies of QtCore, QObject won't know about those classes. Task-number: QTBUG-77126 Change-Id: Ia0be361f9e909fee04e9680d4219c96812306712 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Make QDoc warn about undocumented public classesMartin Smith2019-05-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc was marking all undocumented public API elements as "internal" and "private" because most of these undocumented elements should not be documented. The standard way to tell QDoc not to warn about an undocumented elemewnt in the public API is to give it a QDoc comment with the command "\internl" in it. But it was decided this would require too much work to eliminate all the warnings, because there are so many undocumented elements in the Qt public API that we really don't want to be documented. So we decided to just mark them all as both internal and private in QDoc itself, and that eliminated a great many useless QDoc warnings. But it also meant that QDoc would no longer warn when a public element was left undocumented by mistake. This is most often seen in C++ classes that are in the public API but are not documented. QFutureInterface is an example of a class that is not documented but should be documented because it is useful. This change lets QDoc warn that a class in the public API was not documented with a \class comment. Special cases: 1. If the undocumented class has no members, don't warn that it was not documented with a \class comment. 2. If the undocumented class's name contains the word "Private" it is probably not meant to be in the public API, so don't warn that it has no \class comment. 3. If the undocumented class has no function members, then don't warn that it has no \class comment. 4. If the undocumented class is marked DontDocument, then don't warn that it has no \class comment. The other part of this change relates to item 4 above. To mark a class or struct as DontDocument required adding a new topic command to QDoc. The new topic command is \dontdocument. The argument to this command is a list of class and struct names. The list is enclosed in parentheses. For example: \dontdocument (QMacAutoReleasePool QIncompatibleFlag ... QTextCodec::ConverterState QThreadStorageData) QDoc looks up each name in the list and marks it DontDocument. The documentation generator then sees the node is marked DontDocument and ignores the node. This makes it a lot easier to tell QDoc which public classes and structs should not generate the warning about no documentation. Task-number: QTBUG-57183 Change-Id: I7eee48de03ca7aeb72c63ae90ba373503d41612d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Code cleanup, use nullptr for nullptr constantsPaul Wicking2019-02-081-3/+3
| | | | | | | | | | 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>
* qdoc: Correct ref pages for inner classesMartin Smith2019-02-081-6/+7
| | | | | | | | | | | | | | | | | | | | | | This update corrects the documentation pages for classes, structs, and unions that are declared inside a class or a struct. In Qt, a struct is often declared inside a class. For such internal declarations, the requirements for making the inner entity available were incorrectly shown. All that is really necessary is to include the parent class. So the requirements for including the inner entity are now replaced with, for example, "Struct State is declared in class QAccessible," where QAccessible becomes a link to the reference page for that class. It was easier to implement this change by teaching qdoc to recognize structs and unions in addition to classes, so that is also included in this change. Change-Id: I1a0d46ef19a130506c7bcbf77b46e298f6ab2f71 Task-number: QTBUG-66872 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Major clean-up of FunctionNode and parameter processingv5.13.0-alpha1Martin Smith2019-02-061-33/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This update was motivated by the need to correct two known issues in qdoc. First, linking to overloaded functions failed in some cases because the overloads were not numbered consistently, causing links to go to the wrong overload or to nowhere at all. Second, the mechanism for handling the \relates command didn't support using it to relate a function to more than one class. For example, there are many global qHash() functions spread around QtBase. Each is meant to compute a hash index for an object of some class type, so the object can be inserted into a QHash map for that class type. It is then desired to relate qHash(type Xxx, int seed) to both QHash<type> and class Xxx, so that the documentation for that qHash() function appears as a related non-member function of both QHash<type> and class Xxx. The example above also illustrates the overload numbering problem, because all these qHash() functions are overloads of the name qHash. To make matters worse, they are not all in the same module. Most of them are in QtCore, but a few are in QtNetwork, and this distribution problem will become worse over time as more qHash() functions are added. Prior to this update, qdoc was unable to relate a function to something in a different module, or it didn't always work. While designing a fix for these issues, it became clear that the processing of the FunctionNode and the function parameters would have to be rewritten. That's what this update does. These are the main points: 1. A new subclass of Node is added to act as a proxy for a class in another module. This ProxyNode acts as a place holder for the functions (and possibly other elements) that are related to a class in another module. This is used for the qHash() functions in QtNetwork that are related to QHash in QtCore. qdoc generates an html file named qtnetwork/qhash-proxy.html that contains the documentation for these functions. But these functions are listed as related non-members on the QHash class reference page in the qtcore output directory. They are listed there in the summary, but they link to the qhash-proxy.html page in qtnetwork. 2. A new, Parameters class is added to qdoc (parameters.h and parameters.cpp), and the class Parameter is moved there from node.h. class Parameters replaces the old QVector<Parameter> wherever it was used. This encapsulates all the parameter processing and matching in the Parameters class and simplifies the code at all the places where QVector<Parameter> had been used. 3. The assignment of overload numbers is now done in the normalizeOverloads() function, which is called after all the headers and sources have been processed but before the generate phase begins. This assignment is a simple renumbering now because all the overloads of a function are linked to each other via a nextOverload_ link in the FunctionNode. The first function named qHash() is inserted into the Aggregate node's function map, but subsequent qHash() FunctionNodes are not entered into the function map but are linked to the first qHash() via its nextOverload_ link. 4. The \relates command can now be used multiple times in a single qdoc comment. There remains some work to be done here because this currently only works for global entities, but there are several cases where \relates has been used in the qdoc comment of a member of a class. This will be fixed soon, I believe. When qdoc sees the first \relates Xxx command, for example for qHash(Yyy, seed), that qHash() is a child of the global namespace. qdoc allows it to remain as a child of the global namespace but it tells class Xxx to "adopt" that child (see Node::adoptChild()). This function makes this instance of qHash() be a child of class Xxx (in this case QHash<type>), so that the parent of this qHash() becomes Xxx. After this "adoption," qHash() is a child of both the global namespace and class Xxx, but qHash() only knows it is a child of Xxx, i.e. its parent pointer is Xxx. If this is the first qHash() to become a child of Xxx, it is inserted into the function map of Xxx, but its nextOverload_ link is not changed. This is because all the global qHash() functions have already been linked into the nextOverload_ linked list, and this list must not be changed. Hence, when qdoc searches for qHash(something) to make a link to it, it will find it as a child of the global namespace, but it will correctly link to it using its actual parent pointer. When qdoc sees the second \relates Yyy for this qHash() function, qdoc sees that this FunctionNode has already been made a related non-member of Xxx, so it can't let Yyy "adopt" it. Instead, it tells Yyy to clone this qHash(), which creates a shallow copy of it but resets its nextOverload_ pointer to nullptr. I believe this clone of qHash() won't be found in a search for a function named qHash(), because the global one (the adopted one) will be found first. Or, if it is found, a link to the clone will be generated, but that's ok because the documentation is identical. Note that the existence of qHash in two child lists is taken into account at destruction time. The only place where a Node is destroyed is in the destructor of Tree, which destroys the Node tree from the root down to the leaves. Each aggregate node is responsible for deleting each of its child nodes, but it only deletes a child node if it is the parent of that child node. All of the above revealed that some of the findFunctionNode() functions were either no longer needed or weren't being called in the first place, so they were deleted. This change is now ready for testing. Change-Id: I6da3e2e9e71d39a29d90e073ed614309a49e3d4c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Reorganize Qdoc's Node class hierarchyMartin Smith2018-10-231-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a significant refactoring of QDoc's Node class hierarchy, which is meant to make maintenance of QDoc easier, and which will enable further development of QDoc as a library and plugin. Class DocumentNode is renamed to class PageNode, and it inherits the Node base class instead of inheriting class Aggregate. Class Aggregate inherits class PageNode instead of the Node base class. IOW, class DocumentNode and class Aggregate have swapped places in the class hierarchy, and DocumentNode has changed its name to PageNode. This makes the Node hierarchy more logical because: 1. Every entity that causes a documentation page to be written is a PageNode. 2. Only those PageNodes that can have children are Aggregates. Thus the HeaderFile subtype of the former DocumentNode has been promoted to class HeaderNode, which is a subclass of Aggregate. This makes sense because the old HeaderFile DocumentNode caused a documentation page to be generated, and that documentation page was very much like a class reference page. The \headerfile command is not used a lot in the Qt documentation but there are some useful cases, so it is worth making a subclass of Aggregate to handle them. The HeaderNode is now processed very much like the ClassNode and the NamespaceNode. Developers should be advised that isDocumentNode() is now isPageNode(), but isPageNode() can no longer be used to decide if an Aggregate* is a PageNode* (DocumentNode*), because Aggregate is now a subclass of PageNode. So a new convenience function is added: isTextPageNode(), which returns true if your Node* is a PageNode but not an Aggregate. IOW, isTextPageNode() returns true if the Node* is some kind of text page that doesn't represent a C++ or QML declaration. Class ExampleNode is a subclass of PageNode, not Aggregate. IOW, an ExampleNode no longer has children. Instead, the example files and example images that belong to the example are stored as string lists. It seems to work, but there might be problems in help files I haven't found yet. Class CollectionNode is now a subclass of Node instead of LeafNode. Class LeafNode is removed. All former subclasses of LeafNode are now subclasses of Node. This change also removes a lot of DITA bitrot. Work remaining to be done: 1. Remove the remaining DITA bitrot. 2. Consider letting QmlProperty and JsProperty be instances of Property and use the Genus value to distiguish them. 3. Also consider replacing QmlPropertyGroup and JsPropertyGroup with a single PropertyGroup and use the Genus value to distinguish them. This update also rearranges the parameters passed to the clang parser, and it removes some diff conflict lines that got saved by mistake. Change-Id: I918f83030c48d96db4a5588ab53458f221a5374e Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Fix bugs in resolving inheritance and finding overridden functionsMartin Smith2018-02-231-2/+0
| | | | | | | | | | | | | | | | | | | | | A class node must have pointers to the class nodes of its base classes, but these pointers might not exist when qdoc creates the class node for the class. They might not exist until all the index files and include files have been parsewd. qdoc was trying to resolve the base classes too early. This update lets qdoc wait until it is known that everything has been built before attempting to resolve inheritance. This update also delays finding the pointer to the function node for the overridden function for a function marked "override" until the pointer is needed. Instead of storing the pointer to the node, the qualification path to the function is stored as a string, and the string is used to look up the overridden function when it is needed, which is only when the \reimp command is processed during output. The function that resolves the pointer to the overridden function was moved to the function node class, where it makes more sense. The way a few qdoc warnings are reported was also changed. Change-Id: Ia54642d11242386ae75139065f481e5d30f79fb5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: This ends use of qdoc's old C++ parserMartin Smith2017-09-081-0/+1
| | | | | | | | | | This change replaces the last uses of qdoc's old, ad hoc C++ parser. Clang is now used for parsing all C++ code. \macro, \qmlxxx, and \jsxxx commands are parsed by simple pattern matching functions using QString::split(). Change-Id: If6f95b0487d1dd3206373bc55ec8e6b8b9c55b1e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qdoc: Use clang to parse \fn commandsMartin Smith2017-09-061-0/+1
| | | | | | | | qdoc now uses clang to parse \fn commands. It even handles the multiple \fn case. Change-Id: I259fcdfc1bf180d32ef1cc9886a48aa3006e18fb Reviewed-by: Martin Smith <martin.smith@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>
* qdoc: Fix link disambiguationMartin Smith2016-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | The link command allows a qualifier in square brackets, which tells qdoc the specific kind of page that must be found to satisfy the link. The square bracket parameter was being ignored in one case, because it wasn't being passed to a certain search function. This update passes that parameter to the search function, and the search function uses it to disqualify pages that should not be accepted. This fix causes qdoc to add 4 new qdoc errors when generating the docs for my Qt5 installation. I don't know what these are, but I suspect they are real errors that qdoc was not reporting because the square bracket parameter was being ignored in this case. Change-Id: I45f1fd43039df7bb048711fc5b752a71a006e5de Task-number: QTBUG-51587 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: QML basic types can now have methodsMartin Smith2016-02-221-0/+1
| | | | | | | | | | | \qmlmethod now works for QML basic types. Use it the same way it is used for QML types. \qmlsignal should work now too, but I only tested this for methods. There is now not much difference between QML types and basic types. Change-Id: Ie7dfb01dd2ff0b68944b864ebe29d4a95ba7d550 Task-number: QTBUG-51125 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* qdoc: Add support for listing all examples from all modulesTopi Reinio2015-12-121-0/+3
| | | | | | | | | | | | | | | | | | | | | This commit adds a new argument for \generatelist command, which enables the generation of an 'example index' page: \generatelist annotatedexamples This will generate a set of tables; one for each module, prefixed by a header titled with the module name. The table is an annotated list (title + brief description) for each documented example. A human-readable name for each module is read from the navigation.landingpage .qdocconf variable. This name is written to / read back from the index files as 'indexTitle' attribute. Examples for modules that do not define a landing page title are listed in a single table with no accompanying header. Change-Id: Icb7fa6fb40ec9a0dfce1bf8282c8782a69ec0028 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* move qdoc back to qttoolsOswald Buddenhagen2015-10-231-0/+255
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>