summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/cppcodeparser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* qdoc: inherited members do not show up for QML componentsMartin Smith2013-02-131-5/+4
| | | | | | | | | | | | | | | | | | | | | | | This was a regression bug owing to a big qdoc cleanup for Qt5. But the way QML inheritance had been handled was not a good design, so it has been changed here. When a .qml file is parsed by qdoc, the base type of the QML component is detected, and its name is stored in qdoc's tree node for the component. After qdoc has parsed all the QML files, it traverses the tree, and for each QML component that has a base type name but no base type node pointer yet, it searches the tree for the base type node and stores the pointer to the node in the node for the components. Then when the output generator generates the doc page for the component, it has access to all the inherited members in the base type. Task-number: QTBUG-29569 Change-Id: Ib4958d05f55fa48a572f8ca51ffd57712f29bbc7 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* qdoc: Missing links to qRegisterMetaType()Martin Smith2013-02-081-31/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | A serious problem in the design of qdoc is its C++ parser. It is an ad hoc recursive descent parser, which has not kept pace with Qt's use of the more esoteric aspects of C++. Part of the problem is that qdoc does not send files through the preprocessor before processing them. The bottom line is qdoc needs the C++ parser used in Qt Creator. But that is a long-term solution. In the short term, we have to introduce minor hacks like this one to keep qdoc going until the parser can be replaced. The problem in this case is that qdoc doesn't handle the QT_PREPEND_NAMESPACE macro in function declarations. The solution is to let qdoc ignore the macro and just use the macro's parameter, which is what qdoc wants anyway. Task-number: QTBUG-28953 Change-Id: I5b9efcc10fa8fb500a44854ee995c2e50e9e16b5 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Fix module name formatSze Howe Koh2013-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation QtCore -> Qt Core QtDBus -> Qt D-Bus QtDesigner -> Qt Designer QtGui -> Qt GUI QtImageFormats -> Qt Image Formats QtNetwork -> Qt Network QtPrintSupport -> Qt Print Support QtScript -> Qt Script QtSql -> Qt SQL QtSvg -> Qt SVG QtTest -> Qt Test QtWebKit -> Qt WebKit QtWidgets -> Qt Widgets QtXml -> Qt XML QtConcurrent -> Qt Concurrent (partial) QtQuick -> Qt Quick (partial) Also, distinguish between "module" and "library" Change-Id: Icb8aa695ae60b0e45920b0c8fce4dc763a12b0cd Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* qdoc: Listing group members across modulesMartin Smith2012-11-271-3/+1
| | | | | | | | | | | | | | This is a first attempt at fixing the problem, but it probably is not the entire solution. The problem requires adding attributes to the index files and then reusing them when the index files are read. The same problem will be affecting the module lists themselves, but that is not fixed in this update. Task-number: QTBUG-28036 Change-Id: I8593d5b9446e51a5204b6c71f8c4f2b63f445972 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* qdoc: Added module attribute to most index elementsMartin Smith2012-11-061-2/+2
| | | | | | | | | | | | | | The index file generated by qdoc when it is run in -prepare mode has been modified so that most elements have a module attribute. The value of the module attribute either came from an \inmodule command, or it is the value of the project variable specified in the qdocconf file that was read by qdoc. Task number: QTBUG-27626 Change-Id: I44198bbbc1738fafc110c6b905eb1d67bc745323 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* QDoc: remove the experimental basedir variablePierre Rossi2012-09-281-2/+0
| | | | | | | | | It was introduced in the early days of the docs' modularization and appears not to be used anywhere anymore. Change-Id: I5b0c60d92828624af2129153fce96ad01aec861c Reviewed-by: Martin Smith <martin.smith@digia.com>
* Use QStringList::join(QChar) overload where applicable [tools]Marc Mutz2012-09-231-2/+2
| | | | | | | | | | This is an automated change performing the following replacements: join\("(.)"\) -> join('\1') join\(QLatin1String\("(.)"\)\) -> join(QLatin1Char('\1')) join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1')) Change-Id: Ia087beb886bbaec1a0976cd924440d8904044879 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* qdoc: Refactoring of qdoc data structuresMartin Smith2012-09-141-258/+78
| | | | | | | | | | | | | | | | | | This commit is the beginning of a significant overhaul of qdoc. A new class, QDocDatabase, is added, which will eventually encapsulate all the data structures used by qdoc. In this commit, the Tree class is made private and only accessible from QDocDatabase. Several maps structures are also moved into QDocDatabase from other classes. Much dead code and unused parameters were removed. Further simplification will follow. Change-Id: I237411c50f3ced0d2fc8d3b0fbfdf4e55880f8e9 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* doc: Replaced FakeNode with DocNodeMartin Smith2012-08-211-52/+53
| | | | | | | | | | | | | | | | | | The name FakeNode was a bad choice. It was used to represent something that wasn't derived from a C++ declaration in a .h file. Any generic page or QML item or any special kind of qdoc construct was stored in a FakeNode. The name was unfortunate because the constructs stored in FakeNodes were just as real as C++ constructs. So FakeNode has been renamed to DocNode, which just refers to a documentation node. The node type Fake has been replaced with node type Document. Change-Id: Ida9de8288b7b8915bf9273fd890ca84aaf05e182 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Ignore property functions of obsolete propertiesMartin Smith2012-08-021-1/+1
| | | | | | | | | | | Property setter and getter functions are no longer included in the output when the property itself has been marked \obsolete. Task nr: QTBUG-26425 Change-Id: Iac315445d1916467b12be03989bd4513a03a2397 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Changed \qmlclass to \qmltype, added \instantiatesMartin Smith2012-07-261-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | The \qmlclass qdoc command is now deprecated. Use \qmltype instead. \qmlclass had two arguments, the QML type name and, if the QML type was elemental, the name of the C++ class that the QML element instantiates. The \qmltype command has only one argument, the QML type name. If the QML type is elemental, then the \qmltype command should be followed by a \instantiates context command in the same qdoc comment. e.g.: \qmltype Item \instantiates QDeclarativeItem When the developer does not include the \instantiates command for an elemental QML type, qdoc will no longer be able to detect that the C++ class name is missing, and qdoc will no longer be able to detect when the name specified for a \qmlproperty of the elemental QML type has the wrong name. Task nr: QTBUG-26648 Change-Id: Ia60872a35113a6f615bfc751ce1e9db6279dfb8e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Revert "QDoc: Allow '0' to be used as 2nd arg for \qmlclass."Casper van Donderen2012-07-261-21/+11
| | | | | | | | | | This reverts commit 50dfd15dcc49d12c5335a37999aef041d7fdfaae. The change is not necessary anymore, since a new solution using \instantiates in in the works, having two ways to do exactly the same thing is not necessary. Change-Id: I6e139d760372fc6177023c470850418b2385fccd Reviewed-by: Martin Smith <martin.smith@nokia.com>
* qdoc: Restricted qdoc errors for \reimp commandMartin Smith2012-07-201-26/+28
| | | | | | | | | | | qdoc no longer considers the \reimp command when the parent C++ class has been marked \internal, because the reimplimented functions aren't supposed to be in the documentation at all, when the parent class is internal. Change-Id: I3d811ca737934f95e9078ce7b1e957890f6aaf38 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QDoc: Allow '0' to be used as 2nd arg for \qmlclass.Casper van Donderen2012-06-281-11/+21
| | | | | | | | | There can be occurences of \qmlclass where there is no C++ class (for a pure QML Type for example). QDoc will ignore searching for a C++ class when '0' is specified as second argument to the \qmlclass command. Change-Id: I09c8c7ad302daffb0723a49967951ca623e646e4 Reviewed-by: Martin Smith <martin.smith@nokia.com>
* qdoc: Report multiple topic commands as an errorMartin Smith2012-06-281-0/+13
| | | | | | | | | | | | Some documenters are using two topic commands in a single qdoc comment. This is only allowed for \qmlproperty so that multiple QML properties can be documented with a single comment. qdoc now reports an error for all other combinations of multiple topic commands. Task Nr: QTBUG-26345 Change-Id: I1f9a6d2502ccffa76c2d41f961be3750014a0a56 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Better error messages for QML command errorsMartin Smith2012-06-121-40/+45
| | | | | | | | | | | | Some error messages were not clear for these qdoc commands: \qmlclass, \qmlmodule, \inqmlmodule, and \qmlproperty. They have been made clearer now. Also, qdoc now parses input files in the same order all the time now. The order is alphabetic now. This might not be the optimal order. Change-Id: Id53a5ec8105009c71f4bbd41973a54aed7821099 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Make qdoc compile with QT_STRICT_ITERATORSThiago Macieira2012-05-291-13/+13
| | | | | Change-Id: I2923315678d1aef516b35a8c83fe734367723a28 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed pure doc parserMartin Smith2012-05-251-54/+0
| | | | | | | | | | | | | | | | | | | | | | | | This parser was meant to parse any file for qdoc comments only, ignoring everything else that is not inside a qdoc comment. But it wasn't doing that. It was parsing all code, regardless of the language, using the C++ parser. Now it has been corrected to look at qdoc comments and skip over everything else. Note thast this means qdoc will expect a qdoc topic command in each and every qdoc comment in the file. The posiution of the qdoc comment with respect to the code it is meant to document is not taken into account in the pure doc parser. This is in contrast to the QML and C++ parsers which do take comment location into account in some cases. Change-Id: I0804a4149baa942b463e0b6990c71e4039ac1a50 Reviewed-by: Keith Isdale <keith.isdale@nokia.com> Reviewed-by: Martin Smith <martin.smith@nokia.com>
* qdoc: Report multiple QML property docssMartin Smith2012-05-181-20/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | Documentation authors sometimes make the mistake of documenting a QML property more than once. Here, we refer to cases where a C++ class is documented in a .cpp file as a QML type. In this context one QML property might be documented in two qdoc comments, because the author of the second comment does not search the file for an existing qdoc comment for the property before adding the second one. When DITA XML is generated for this case, the QML type element will contain two <qmlproperty> elements with identical id attributes, which is invalid XML. id attributes must be unique within an XML document. qdoc now reports an error for this case, indicating that the QMLN property has been documented multiple times. This problem can't occur when documenting QML in a .qml file because in .qml files, each comment must appear directly above the thing it applies to. Change-Id: I3a22650a58371fbda2ac7a5429fc036f41750423 Reviewed-by: Martin Smith <martin.smith@nokia.com>
* qdoc: Fix some QString usage issues (Krazy warnings).Friedemann Kleint2012-05-161-3/+3
| | | | | | | | - Avoid single-character constants. - Use QString() instead of "". Change-Id: If04eff389e7b6d4a18201365b711708fdf545d00 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fix warnings about unused variables.Friedemann Kleint2012-05-161-4/+4
| | | | | Change-Id: I2052da55022334362efb5765335f00692f4c65fa Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed a regression bug caused by fixing error messagesMartin Smith2012-05-111-5/+6
| | | | | | | | | | | | | The C++ code marker is the default code marker. The default code marker was being called for .qdoc files. But when the tree nodes were each assigned a location object based on the location in the source file where the node was built, the default code marker was no longer used. Instead, the plain code marker was used. This was wrong. qdoc now knows to use the C++ code marker for all .qdoc files. Change-Id: I15a58168db74cc5aa82a1fbccc5b7ece219ec297 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QDoc: Return correct path when quoting example files.Casper van Donderen2012-05-111-0/+2
| | | | | | | | | When the exampledirs qdocconf variable is . the first 2 characters of the file to quote from were being cut off, since there was a string comparison between the size of the strings with and without './' Change-Id: Iede54b5f77ec8a7530c608908f08e7eb4351f0f1 Reviewed-by: Martin Smith <martin.smith@nokia.com>
* qdoc: Fixed a qdoc error problemMartin Smith2012-05-101-47/+50
| | | | | | | | | | When a page exists in more than one file, qdoc was reporting this sometimes without reference to the locations of the files. This has now been fixed. Change-Id: I0697acc170b94a74b15fb384556dd76f764f7792 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed three qdoc error problemsMartin Smith2012-05-091-0/+5
| | | | | | | | | | | | | | | | | | 1. For QML properties documented in a .qml file, qdoc no longer prints the error message that it can't detect whether the property is read-only. 2. For QML properties documented in .cpp files, qdoc now includes the file path and line number, when it prints the error that it can't detect whether the property is read-only. 3. qdoc also includes the completely qualified property name in the error messages described in 2. Change-Id: If88381783fd0f29271f579ae170a0a6f4b1a7344 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed a qdoc error problemMartin Smith2012-05-091-4/+6
| | | | | | | | | | | When an example was missing, qdoc printed an error message without specifying the location of the error. Now it includes the file path and line number of the \example command where the error can be fixed. Change-Id: Ib75ffc467c0f266ed3939b8aa4b24800ec5eb92e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed qdoc error messagesMartin Smith2012-05-091-43/+66
| | | | | | | | | | | qdoc prints many error messages without including the source file path and the line number for where the error occurs. This makes it difficult to find the place to fix the error. This update corrects some of those error messages. Further updates will fix the others. Change-Id: I9c0eed96482c61643a2d83c5135368413e63ae52 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed minor version number in DITA XMLMartin Smith2012-05-041-1/+1
| | | | | | | | | The DITA XML didn't contain the correct QML Module version mumber in the imports statement. Change-Id: I22b75facc1396c5adea88be49c86fff11f19f27b Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QDoc: Fix no-examples option.Martin Smith2012-04-111-3/+5
| | | | | | | | This was accidentally removed in the big change regarding searching in the internal QDoc tree. Change-Id: I2496d7497d239f1ec5fbd01be6a918c1ef29fc95 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Fixed to report read-only QML properties correctlyMartin Smith2012-04-111-5/+11
| | | | | | | | | | | | Now the default for a QML property is writable. If qdoc can't detect the actual read-only status, writable is assumed. There were some cases where qdoc could not determine the actual read-only/writable status for a QML property. In these cases, qdoc reported read-only because the default was read-only, which was not optimal. Change-Id: I55aeb2bedcde92a414f4d48a8d995e5e9dbca5da Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: findNodeRecursive() was called with a null start nodeMartin Smith2012-04-031-2/+2
| | | | | | | | | | | This occurred in several places. They have all been corrected to start at the tree root, when the start node passed is null. Task nr: QTBUG-25146 Change-Id: I5d75db0626451d30e8be8de5605036ba168f2a14 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Allow documenting a C++ class as a QML type.Martin Smith2012-04-021-137/+143
| | | | | | | | | | | | | | | | | | | Now qdoc can handle the case where a C++ class is documented as a QML type of the same name, or as both a C++ class and a QML type of the same name. And collisions pages are created for both the HTML and the DITA XML output. A collision page is created when two items have the same name. The collision pages will be augmented later to include the list of pages where ambiguous links to one of the items listed on the collision page are actually located, so the writer can go back to those links and add the appropriate qualifier. Change-Id: I5a9632b2d2209e0784392047056bed8962005624 Reviewed-by: Martin Smith <martin.smith@nokia.com> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc: Add CLI option to not generate example docs.Casper van Donderen2012-03-281-3/+5
| | | | | Change-Id: I059ae76430adada020d338905b39ba3089c89615 Reviewed-by: Martin Smith <martin.smith@nokia.com>
* qdoc3: Change suffix of DITA files to .ditaMartin Smith2012-03-151-1/+1
| | | | | | | | | | The files output by the DITA XML generator now have .dita on the end instead of .xml, but the ditamap files still use .ditamap . Task-number: Mzilla bug - 7291 Change-Id: Idb8b70c5d3f2ac2c4fdf195e385393f7ac68b7ba Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* qdoc3: qdoc now handles overloaded methods for QMLMartin Smith2012-03-131-1/+2
| | | | | | | | | | | | When a C++ class is documented as a QML type, it can have overloaded QML methods. These are now handled correctly by qdoc. The method list for QML types is now output with the full method signature. For signals and handlers too. Task-number: QTBUG-24670 Change-Id: If529d4136f5b480373b6ac25d2dceef15e6ea3db Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Move qdoc into qtbase and bootstrap itLars Knoll2012-03-081-0/+2502
We need qdoc in qtbase to be able to properly modularize our documentation and build it when building the different Qt modules. qdoc does contain a copy of the qml parser from qmldevtools, but this is the lesser evil compared to how we are currently forced to genereate our docs (and the fact that no developer can run qdoc and check the docs for their module). Change-Id: I9f748459382a11cf5d5153d1ee611d7a5d3f4ac1 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com> Reviewed-by: Martin Smith <martin.smith@nokia.com>