summaryrefslogtreecommitdiff
path: root/src/qdoc/generator.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Port QtTools from QStringRef to QStringViewKarsten Heimrich2020-06-151-5/+5
| | | | | | Task-number: QTBUG-84319 Change-Id: Idb5a41172ea38b2f4edf385d67c1cdc2968a8d8c Reviewed-by: Mårten Nordheim <marten.nordheim@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: Clean up members in GeneratorPaul Wicking2020-06-051-25/+17
| | | | | | | | | | * Prefer m_ prefix over _ suffix for consistency. * Ensure members are initialized in header. Coverity-Id: 11492 Task-number: QTBUG-79116 Change-Id: I43e5c531e902d27ab5c682fb40b16f4312012fda Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Remove unused code in GeneratorPaul Wicking2020-06-051-11/+1
| | | | | | | | | ...and the corresponding code in Config that becomes unused as a result of the removal in Generator. Task-number: QTBUG-79116 Change-Id: Ibbb58077fa1943e81ae95a38b3cc09c3d9e74fe3 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract Aggregate from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: If28cc8b41401c90dfa48b613211b3d0a4dcd815a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract ExampleNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: Ieae12d5a75c89470165759fb92c79897d9ad910c Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract CollectionNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: Icf8db259a269d0e31f4686097addcfdde1e77f14 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract ClassNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I3622fe2525b50793f71d027c344127532c2a451c 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: Extract RelatedClass from NodePaul Wicking2020-06-041-5/+5
| | | | | | Task-number: QTBUG-84578 Change-Id: I9163f464b84bf1a408163961bce71dde0ef5add9 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract enum Access from NodePaul Wicking2020-06-041-3/+4
| | | | | | | | | | | | | Move Node::Access out of Node and make it a scoped enum, to break circular dependency issues between Node and RelatedClass. This is a requirement to extract struct RelatedClass from Node. Task-number: QTBUG-84578 Change-Id: I13a1ac275d46abcd04f5f712291c77c2f24a65db Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract EnumNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I06f0f91677adc5f0673b1eba414b131def101601 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract TypedefNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I8fbe13faefd918b616f8d0d4bc08077a880b6194 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract SharedCommentNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I088ffba80e191723c06c6518435afabb0ffd7a4d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract FunctionNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I5967054a1c802ac6daf2622dcd4e4c8c4b3977ac Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Extract PropertyNode from NodePaul Wicking2020-06-041-0/+1
| | | | | | Task-number: QTBUG-84578 Change-Id: I88b684150e797a92e943f064019a418d640065a7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Drop half-baked translation effortPaul Wicking2020-06-041-40/+48
| | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.15' into devTopi Reinio2020-05-291-7/+34
|\ | | | | | | Change-Id: I8c1fc05462e1b99b16d52e4f43b2b4b1aa645152
| * qdoc: properly implement \typealias commandTopi Reinio2020-04-231-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | \typealias was already a command recognized by QDoc, but it was simply treated as a synonym for \typedef and was not documented. Implement proper support for the command: - Add [alias] designation both in type summary and details. - Auto-generate information about the aliased type, including a link if aliasing a public, documented type. - Auto-convert aliases documented with \typedef to type aliases. - Add basic support for aliases also to DocBook and WebXML generators. - Document \typealias. Fixes: QTBUG-82712 Change-Id: Iafa8c7def0a7488d7521fbc2862290a9bb3167ff Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Get rid of QTextCodec dependency in qdocLars Knoll2020-05-181-4/+0
| | | | | | | | | | Change-Id: I5e7ab8402f522eca11465cb968b87e04212977ed Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Port qdoc to QRegularExpressionLars Knoll2020-05-181-2/+3
| | | | | | | | | | Change-Id: I2c9eb349a92503afcdd41bacf556e561d9f8c098 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | QDoc: Get rid of Q_GLOBAL_STATICs in doc.cppPaul Wicking2020-05-071-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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: Remove unused method in GeneratorPaul Wicking2020-05-071-20/+0
|/ | | | | Change-Id: I6466cf89060b5d1ed836de878ae078a0819d5f14 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Use correct node type string for \since in shared commentsPaul Wicking2020-03-061-0/+4
| | | | | | | | | | | | | | | | | Shared comment nodes were not handled as a special case when generating "This [class/function/method/type/etc] was introduced in" strings when QDoc encountered a \since command. These ended up with the default value, "documentation", which led to unexpected text in the documentation. * Add handling of shared comment nodes and get the node type from the first node in the collective. * Amend generated output test to cover this scenario. Fixes: QTBUG-82534 Change-Id: I444e95e0214f312649ec2720c23c98e698402abf Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Add an auto-generated note in \qmlsignal documentationTopi Reinio2020-03-061-0/+12
| | | | | | | | | | | | | | | Construct the signal handler name and generate a note for it. This eliminates the need to maintain such notes in the source. Remove the hard-coded notes from the test source (but not from the expected output data). [ChangeLog][qdoc] QDoc now generates a note for the name of the corresponding handler in \qmlsignal documentation. Task-number: QTBUG-37355 Change-Id: Ia3ab98be909a41bde619224c9a616cb8704e258a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Refactor automatic note generation for function nodesTopi Reinio2020-03-061-39/+80
| | | | | | | | | | | | | | | | | | | | Function nodes may have a number of automatically generated notes added to the documentation; as they share the same formatting, collect them into a single virtual function in Generator, and override it in DocBookGenerator. Call the virtual function in Generator::generateBody() after generating the text for the Doc instance. As we append the notes to the body, the order in which the notes appear may change slightly (if a function comment generates multiple notes). Add \note commands in the tests in preparation for a follow-up commit that utilizes the refactored code. Task-number: QTBUG-37355 Change-Id: Id92926e53b61e03a2d2feceda70987191b708975 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Fix issues in HelpProjectWriterTopi Reinio2020-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The code that generates Qt Help Project (.qhp) xml files was suffering from multiple issues - mostly related to changes in Node inheritance that were not reflected in HelpProjectWriter implementation. - We no longer have subtypes for page nodes. Therefore, selectors like 'doc:example' were broken. Simplify the selector code but continue supporting the old notation. - Examples and basic QML/JS types were incorrectly dropped from the TOC. - Node::Union and Node::Struct were called 'Class' in the .qhp. Use the Generator::typeString() to fetch the correct type name for all types. - Require .qhp subprojects to have at least a title to avoid empty subsections in the TOC. Add a test that covers the entire .qhp generation with different types of subprojects defined. Fixes: QTBUG-82671 Fixes: QTBUG-82674 Change-Id: I8fe4a8ad5fc6d58f86e0e9128e98c0b8c4ba4a6a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QDoc: Disentangle Generator and ConfigPaul Wicking2020-03-041-6/+2
| | | | | | | | | | | | | | | | * Keep track of use of DocBook extensions in Config. * Let Location query Config about use of Timestamps in logging. * Set writeQaPages in Config and get it from there. * Let Location query Config about whether logging is enabled or not. * Let Config track if QDoc is running in single or dual exec mode. * Move phase information to Config and track the current phase state there. * Remove the inclusion of generator.h from config.cpp, clangcodeparser.cpp. Task-number: QTBUG-82106 Change-Id: I06c8aeb40417e5c83cfa693f5f1ab2c210d34469 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-181-2/+4
| | | | | Change-Id: I98eaf748fdfb34f32d187718459327b8eef9c54b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Format according to stylePaul Wicking2020-02-141-3/+5
| | | | | | | Run clang-format across QDoc, this is the result. Change-Id: Iaabad0a07a0495990013cbf5995c65db531a7d0d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Avoid excessive 'Illegal \reimp' warningsv5.15.0-alpha1Topi Reinio2020-02-071-5/+4
| | | | | | | | | | | | | | | | | In Generator::generateReimplementsClause(), QDoc tries to output reimplementation information for function nodes, and intends to print out a warning if there is no documented virtual function in the base class to override. This warning was triggered too often - especially, when the base implementation was an \internal class, and the documented reimplementation did not even use the \reimp command. This commit fixes the warning to be omitted for \internal base member functions. Change-Id: Ic39327520b28e5034c489a4037297210fa8b10d9 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* qdoc: Handle \qmlmodule pages that are marked \internalTopi Reinio2020-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A special case of QML type documentation is a one where a type does not require an import statement to be usable, and is not a basic type. If the \inqmlmodule command was omitted, QDoc warned about it and generated an incomplete import statement in the type reference. We still want to see those warnings as they often are valid, but allow the above usecase by marking a QML module \internal: /*! \qmlmodule internal 1.0 \internal */ /*! \qmltype SomeType \inqmlmodule internal */ Such a type will generate otherwise normal reference page, but without an import statement. Also, the (internal) module name will not appear in the generated file names (qml-sometype.html). Fixes: QTBUG-81613 Change-Id: I50bb08f48fc4e7dbc7602ab20de39e039213810b Reviewed-by: Dominik Holland <dominik.holland@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* qdoc: Make Config a singletonTopi Reinio2020-01-131-15/+16
| | | | | | | | | | | | 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>
* Implement DocBook support for qdocThibaut Cuvelier2020-01-031-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The use of this code would be to overhaul the translation project of the documentation in French, for Developpez.com (which is now stuck at Qt 4.7 due to outdated tools: https://qt.developpez.com/doc/). This means that this code will be used and maintained, whatever the decision follows QTBUG-71493, for instance. The DocBook support is not 100% vanilla DocBook, as some tags are missing, but rather an extension (which could be officialised soon: https://github.com/docbook/docbook/issues/111). These tags are used to encode metadata about the code being commented (classes, fields, functions, etc.). More precisely, the required tags are: [enum|macro|namespace|typedef|union][|name|synopsis], enum[value|identifier|item], [specialized]template[id]. These extensions can be enabled by the docbook-extensions parameter. If you want to see the history: https://github.com/dourouc05/qttools/tree/dourouc05-qdoc-docbook Change-Id: I919976d8680b41c5ca69bdb79a0b824c29b89d05 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io>
* clang-format QDocPaul Wicking2019-12-171-329/+201
| | | | | | | | | | | | | | | | 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>
* Factor out the formatting of the "since" textThibaut Cuvelier2019-12-131-15/+19
| | | | | | Change-Id: I3ec3342eb3362664c605c4120238566d87c8b176 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QDoc: Use QVector instead of QListPaul Wicking2019-12-121-6/+6
| | | | | | | | | | | 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: Clean up loops with iteratorsPaul Wicking2019-12-101-85/+56
| | | | | | | | | | | - 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: Get rid of out-parameterPaul Wicking2019-12-101-2/+1
| | | | | Change-Id: Ifbd739510abd5bec4cc2b4fbac9b6667d9ae9281 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove "Node" header dependency from the "Generator"Levon Sargsyan2019-12-041-0/+1
| | | | | | | | | | | | Change substitutes Node header dependency on Generator with forward-declaration. This doesn't break any functionality since the header of Generator references only Node pointers. Aim of such change is aligned with the strategy of breaking down any unnecessary dependencies in the code to make qdoc unit-testable. Change-Id: Ia2ef2f2fb62a1435bffeda1f1b389a3079ac12b0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Introduce XmlGenerator to merge common functions for outputsThibaut Cuvelier2019-12-021-45/+83
| | | | | | | | HTML, WebXML, and the future DocBook output Fixes: QTBUG-80100 Change-Id: Idf373e3b1d76ab808597dcabd8649ecb5e2df0f7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Rename functions to better describe their impactThibaut Cuvelier2019-11-281-5/+3
| | | | | | | | Also, remove an argument they were muting to instead return a new value. Change-Id: Ibe6c73d36988ed76884c5d5bbdd656bfb5221b3e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Correct a typo in a commentThibaut Cuvelier2019-11-211-5/+1
| | | | | Change-Id: I41841706c17fee870ca91e679d63a7a00d876519 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Update documentationThibaut Cuvelier2019-11-181-3/+2
| | | | | Change-Id: I026206b27518da416773eb1a240e2a5b0ee4449c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Clean-up some codeThibaut Cuvelier2019-11-181-9/+9
| | | | | Change-Id: I1b5d0d96c8955852369ecc8717b020335f05c010 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add missing spacesThibaut Cuvelier2019-11-181-4/+4
| | | | | Change-Id: I044702411c8aba3286c98d42962a4d19720e33fb Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Change documentation as proposed by Edward WelbourneThibaut Cuvelier2019-11-181-3/+4
| | | | | Change-Id: Ida9040a17e05b193974d39d72a9998c0a63ed892 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Change spaces to follow coding rulesThibaut Cuvelier2019-11-131-3/+3
| | | | | Change-Id: I81de861e9daa00249c47ddbe259f43f47d7c6615 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-11-051-2/+2
|\ | | | | | | Change-Id: Id9060f7bd9103d8f9e29f71d397f3615ead183dc
| * Correct a few typos in qdocThibaut Cuvelier2019-10-221-2/+2
| | | | | | | | | | | | Change-Id: I6b9a66f15308ecbbdbeaf2dc66de3875b16dd03f Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>