Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
codeparser.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef CODEPARSER_H
5#define CODEPARSER_H
6
7#include "node.h"
8
9#include <QtCore/qset.h>
10
11QT_BEGIN_NAMESPACE
12
13#define COMMAND_ABSTRACT QLatin1String("abstract")
14#define COMMAND_CLASS QLatin1String("class")
15#define COMMAND_CMAKEPACKAGE QLatin1String("cmakepackage")
16#define COMMAND_CMAKECOMPONENT QLatin1String("cmakecomponent")
17#define COMMAND_CMAKETARGETITEM QLatin1String("cmaketargetitem")
18#define COMMAND_COMPARES QLatin1String("compares")
19#define COMMAND_COMPARESWITH QLatin1String("compareswith")
20#define COMMAND_DEFAULT QLatin1String("default")
21#define COMMAND_DEPRECATED QLatin1String("deprecated") // ### don't document
22#define COMMAND_DONTDOCUMENT QLatin1String("dontdocument")
23#define COMMAND_ENUM QLatin1String("enum")
24#define COMMAND_EXAMPLE QLatin1String("example")
25#define COMMAND_EXTERNALPAGE QLatin1String("externalpage")
26#define COMMAND_FN QLatin1String("fn")
27#define COMMAND_GROUP QLatin1String("group")
28#define COMMAND_HEADERFILE QLatin1String("headerfile")
29#define COMMAND_INGROUP QLatin1String("ingroup")
30#define COMMAND_INHEADERFILE QLatin1String("inheaderfile")
31#define COMMAND_INMODULE QLatin1String("inmodule") // ### don't document
32#define COMMAND_INPUBLICGROUP QLatin1String("inpublicgroup")
33#define COMMAND_INQMLMODULE QLatin1String("inqmlmodule")
34#define COMMAND_INTERNAL QLatin1String("internal")
35#define COMMAND_MACRO QLatin1String("macro")
36#define COMMAND_MODULE QLatin1String("module")
37#define COMMAND_MODULESTATE QLatin1String("modulestate")
38#define COMMAND_NAMESPACE QLatin1String("namespace")
39#define COMMAND_NEXTPAGE QLatin1String("nextpage")
40#define COMMAND_NOAUTOLIST QLatin1String("noautolist")
41#define COMMAND_NONREENTRANT QLatin1String("nonreentrant")
42#define COMMAND_OBSOLETE QLatin1String("obsolete")
43#define COMMAND_OVERLOAD QLatin1String("overload")
44#define COMMAND_PAGE QLatin1String("page")
45#define COMMAND_PRELIMINARY QLatin1String("preliminary")
46#define COMMAND_PREVIOUSPAGE QLatin1String("previouspage")
47#define COMMAND_PROPERTY QLatin1String("property")
48#define COMMAND_QMLABSTRACT QLatin1String("qmlabstract")
49#define COMMAND_QMLATTACHEDMETHOD QLatin1String("qmlattachedmethod")
50#define COMMAND_QMLATTACHEDPROPERTY QLatin1String("qmlattachedproperty")
51#define COMMAND_QMLATTACHEDSIGNAL QLatin1String("qmlattachedsignal")
52#define COMMAND_QMLVALUETYPE QLatin1String("qmlvaluetype")
53#define COMMAND_QMLCLASS QLatin1String("qmlclass")
54#define COMMAND_QMLDEFAULT QLatin1String("qmldefault")
55#define COMMAND_QMLENUMERATORSFROM QLatin1String("qmlenumeratorsfrom")
56#define COMMAND_QMLINHERITS QLatin1String("inherits")
57#define COMMAND_QMLINSTANTIATES QLatin1String("instantiates") // TODO Qt 7.0.0 - Remove: Deprecated since 6.8.
58#define COMMAND_QMLMETHOD QLatin1String("qmlmethod")
59#define COMMAND_QMLMODULE QLatin1String("qmlmodule")
60#define COMMAND_QMLNATIVETYPE QLatin1String("nativetype")
61#define COMMAND_QMLPROPERTY QLatin1String("qmlproperty")
62#define COMMAND_QMLPROPERTYGROUP QLatin1String("qmlpropertygroup")
63#define COMMAND_QMLREADONLY QLatin1String("readonly")
64#define COMMAND_QMLREQUIRED QLatin1String("required")
65#define COMMAND_QMLSIGNAL QLatin1String("qmlsignal")
66#define COMMAND_QMLTYPE QLatin1String("qmltype")
67#define COMMAND_QTCMAKEPACKAGE QLatin1String("qtcmakepackage")
68#define COMMAND_QTCMAKETARGETITEM QLatin1String("qtcmaketargetitem")
69#define COMMAND_QTVARIABLE QLatin1String("qtvariable")
70#define COMMAND_REENTRANT QLatin1String("reentrant")
71#define COMMAND_REIMP QLatin1String("reimp")
72#define COMMAND_RELATES QLatin1String("relates")
73#define COMMAND_SINCE QLatin1String("since")
74#define COMMAND_STRUCT QLatin1String("struct")
75#define COMMAND_SUBTITLE QLatin1String("subtitle")
76#define COMMAND_STARTPAGE QLatin1String("startpage")
77#define COMMAND_THREADSAFE QLatin1String("threadsafe")
78#define COMMAND_TITLE QLatin1String("title")
79#define COMMAND_TYPEALIAS QLatin1String("typealias")
80#define COMMAND_TYPEDEF QLatin1String("typedef")
81#define COMMAND_VARIABLE QLatin1String("variable")
82#define COMMAND_VERSION QLatin1String("version")
83#define COMMAND_UNION QLatin1String("union")
84#define COMMAND_WRAPPER QLatin1String("wrapper")
85#define COMMAND_ATTRIBUTION QLatin1String("attribution")
86
87// deprecated alias of qmlvaluetype
88#define COMMAND_QMLBASICTYPE QLatin1String("qmlbasictype")
89
90class Location;
91class QString;
92class QDocDatabase;
93class CppCodeParser;
94
99
104
106{
107public:
117
118public:
119 CodeParser();
120 virtual ~CodeParser();
121
122 virtual void initializeParser() = 0;
123 virtual void terminateParser();
124 virtual QString language() = 0;
126 virtual void parseSourceFile(const Location &location, const QString &filePath, CppCodeParser& cpp_code_parser) = 0;
127
128 static void initialize();
129 static void terminate();
130 static CodeParser *parserForLanguage(const QString &language);
131 static CodeParser *parserForSourceFile(const QString &filePath);
132 static void setLink(Node *node, Node::LinkType linkType, const QString &arg);
133 static bool isWorthWarningAbout(const Doc &doc);
134
135protected:
136 static void extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc);
138
139private:
140 static QList<CodeParser *> s_parsers;
141};
142
143QT_END_NAMESPACE
144
145#endif
int main(int argc, char *argv[])
[2]
Definition buffer.cpp:77
std::optional< PCHFile > buildPCH(QDocDatabase *qdb, QString module_header, const std::set< Config::HeaderFilePath > &all_headers, const std::vector< QByteArray > &include_paths, const QList< QByteArray > &defines)
Building the PCH must be possible when there are no .cpp files, so it is moved here to its own member...
struct CXTranslationUnitImpl * CXTranslationUnit
ParsedCppFileIR parse_cpp_file(const QString &filePath)
Get ready to parse the C++ cpp file identified by filePath and add its parsed contents to the databas...
ClangCodeParser(QDocDatabase *qdb, Config &, const std::vector< QByteArray > &include_paths, const QList< QByteArray > &defines, std::optional< std::reference_wrapper< const PCHFile > > pch)
static void initialize()
All the code markers in the static list are initialized here, after the qdoc configuration file has b...
static void terminate()
All the code markers in the static list are terminated here.
static const QSet< QString > common_meta_commands
Definition codeparser.h:108
virtual void initializeParser()=0
virtual void terminateParser()
Terminating a code parser is trivial.
CodeParser()
The constructor adds this code parser to the static list of code parsers.
static void setLink(Node *node, Node::LinkType linkType, const QString &arg)
virtual QString language()=0
virtual void parseSourceFile(const Location &location, const QString &filePath, CppCodeParser &cpp_code_parser)=0
QDocDatabase * m_qdb
Definition codeparser.h:137
static CodeParser * parserForLanguage(const QString &language)
static CodeParser * parserForSourceFile(const QString &filePath)
static bool isWorthWarningAbout(const Doc &doc)
Test for whether a doc comment warrants warnings.
virtual QStringList sourceFileNameFilter()=0
virtual ~CodeParser()
The destructor removes this code parser from the static list of code parsers.
static void extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc)
static void initialize()
All the code parsers in the static list are initialized here, after the qdoc configuration variables ...
static void terminate()
All the code parsers in the static list are terminated here.
bool asBool() const
Returns this config variable as a boolean.
Definition config.cpp:264
The Config class contains the configuration variables for controlling how qdoc produces documentation...
Definition config.h:84
static const QString dot
Definition config.h:162
bool singleExec() const
Definition config.h:404
@ IncludePaths
Definition config.h:104
const Location & location() const
Definition config.h:121
const ExcludedPaths & getExcludedPaths()
Definition config.cpp:1406
bool dualExec() const
Definition config.h:409
bool preparing() const
Definition config.h:181
bool getDebug() const
Definition config.h:108
CppCodeParser(FnCommandParser &&parser)
void processMetaCommands(const Doc &doc, Node *node)
The topic command has been processed, and now doc and node are passed to this function to get the met...
DocBookGenerator(FileResolver &file_resolver)
Definition doc.h:31
static void initialize(FileResolver &file_resolver)
Definition doc.cpp:308
static void terminate()
All the heap allocated variables are deleted.
Definition doc.cpp:361
Encapsulate the logic that QDoc uses to find files whose path is provided by the user and that are re...
static void initialize()
static void terminate()
HtmlGenerator(FileResolver &file_resolver)
The Location class provides a way to mark a location in a file.
Definition location.h:15
static int exitCode()
Returns the error code QDoc should exit with; EXIT_SUCCESS or the number of documentation warnings if...
Definition location.cpp:244
static void initialize()
Gets several parameters from the config, including tab size, program name, and a regular expression t...
Definition location.cpp:297
Location()
Constructs an empty location.
Definition location.cpp:40
static void terminate()
Apparently, all this does is delete the regular expression used for intercepting certain error messag...
Definition location.cpp:324
This class represents a C++ namespace.
Tree * tree() const override
Returns a pointer to the Tree that contains this NamespaceNode.
LinkType
An unsigned char value that probably should be moved out of the Node base class.
Definition node.h:112
PureDocParser(const Location &location)
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static void destroyQdocDB()
Destroys the singleton.
static QDocDatabase * qdocDB()
Creates the singleton.
NamespaceNode * primaryTreeRoot()
Returns a pointer to the root node of the primary tree.
void processForest()
This function calls a set of functions for each tree in the forest that has not already been analyzed...
void clearSearchOrder()
void resolveStuff()
Performs several housekeeping tasks prior to generating the documentation.
static void terminate()
Clear the static maps so that subsequent runs don't try to use contents from a previous run.
SourceFileParser(ClangCodeParser &clang_parser, PureDocParser &pure_parser)
static void terminate()
The heap allocated variables are freed here.
static void initialize()
WebXMLGenerator(FileResolver &file_resolver)
#define COMMAND_QMLINHERITS
Definition codeparser.h:56
#define COMMAND_MODULESTATE
Definition codeparser.h:37
#define COMMAND_INTERNAL
Definition codeparser.h:34
#define COMMAND_NONREENTRANT
Definition codeparser.h:41
#define COMMAND_OBSOLETE
Definition codeparser.h:42
#define COMMAND_INMODULE
Definition codeparser.h:31
#define COMMAND_DEPRECATED
Definition codeparser.h:21
#define COMMAND_PRELIMINARY
Definition codeparser.h:45
#define COMMAND_WRAPPER
Definition codeparser.h:84
#define COMMAND_CMAKETARGETITEM
Definition codeparser.h:17
#define COMMAND_REENTRANT
Definition codeparser.h:70
#define COMMAND_TITLE
Definition codeparser.h:78
#define COMMAND_STARTPAGE
Definition codeparser.h:76
#define COMMAND_QMLDEFAULT
Definition codeparser.h:54
#define COMMAND_SINCE
Definition codeparser.h:73
#define COMMAND_QMLABSTRACT
Definition codeparser.h:48
#define COMMAND_QTVARIABLE
Definition codeparser.h:69
#define COMMAND_QTCMAKEPACKAGE
Definition codeparser.h:67
#define COMMAND_NOAUTOLIST
Definition codeparser.h:40
#define COMMAND_QTCMAKETARGETITEM
Definition codeparser.h:68
#define COMMAND_DEFAULT
Definition codeparser.h:20
#define COMMAND_THREADSAFE
Definition codeparser.h:77
#define COMMAND_CMAKECOMPONENT
Definition codeparser.h:16
#define COMMAND_QMLREADONLY
Definition codeparser.h:63
#define COMMAND_QMLENUMERATORSFROM
Definition codeparser.h:55
#define COMMAND_INPUBLICGROUP
Definition codeparser.h:32
#define COMMAND_QMLREQUIRED
Definition codeparser.h:64
#define COMMAND_ABSTRACT
Definition codeparser.h:13
#define COMMAND_ATTRIBUTION
Definition codeparser.h:85
#define COMMAND_INQMLMODULE
Definition codeparser.h:33
#define COMMAND_CMAKEPACKAGE
Definition codeparser.h:15
#define COMMAND_INGROUP
Definition codeparser.h:29
#define COMMAND_SUBTITLE
Definition codeparser.h:75
#define CONFIG_SOURCES
Definition config.h:384
#define CONFIG_VERSION
Definition config.h:394
#define CONFIG_EXAMPLEDIRS
Definition config.h:337
#define CONFIG_INDEXES
Definition config.h:358
#define CONFIG_DEFINES
Definition config.h:331
#define CONFIG_DEPENDS
Definition config.h:332
#define CONFIG_NOLINKERRORS
Definition config.h:369
#define CONFIG_LOGPROGRESS
Definition config.h:363
#define CONFIG_IMAGEDIRS
Definition config.h:355
#define CONFIG_PROJECT
Definition config.h:375
#define CONFIG_SOURCEDIRS
Definition config.h:382
#define CONFIG_HEADERS
Definition config.h:346
#define CONFIG_DOCUMENTATIONINHEADERS
Definition config.h:335
#define CONFIG_NAVIGATION
Definition config.h:368
#define CONFIG_LANDINGPAGE
Definition config.h:359
#define CONFIG_OUTPUTFORMATS
Definition config.h:371
#define CONFIG_LANDINGTITLE
Definition config.h:360
#define CONFIG_MODULEHEADER
Definition config.h:366
#define CONFIG_HEADERDIRS
Definition config.h:345
#define CONFIG_INCLUDEPATHS
Definition config.h:356
Combined button and popup list for selecting options.
This namespace holds QDoc-internal utility methods.
Definition utilities.h:15
bool debugging()
Definition utilities.cpp:38
static void parseSourceFiles(std::vector< QString > &&sources, SourceFileParser &source_file_parser, CppCodeParser &cpp_code_parser)
Definition main.cpp:64
static void singleExecutionMode()
Definition main.cpp:652
void logStartEndMessage(const QLatin1String &startStop, Config &config)
Definition main.cpp:273
static void processQdocconfFile(const QString &fileName)
Processes the qdoc config file fileName.
Definition main.cpp:295
static void clearModuleDependenciesAndProcessQdocconfFile(const QStringList &qdocFiles)
Definition main.cpp:634
static void dualExecutionMode()
Definition main.cpp:669
bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
Definition main.cpp:45
static void loadIndexFiles(const QSet< QString > &formats)
Read some XML indexes containing definitions from other documentation sets.
Definition main.cpp:121
FnCommandParser(QDocDatabase *qdb, const std::set< Config::HeaderFilePath > &all_headers, const QList< QByteArray > &defines, std::optional< std::reference_wrapper< const PCHFile > > pch)
std::variant< Node *, FnMatchError > operator()(const Location &location, const QString &fnSignature, const QString &idTag, QStringList context)
Use clang to parse the function signature from a function command.
QByteArray name
QTemporaryDir dir
Processes parser errors and outputs warnings for them.
Definition parsererror.h:20
QStringList context
Definition codeparser.h:97