11#include <QtCore/qregularexpression.h>
15QList<CodeParser *> CodeParser::s_parsers;
18
19
20
24 s_parsers.prepend(
this);
28
29
30
33 s_parsers.removeAll(
this);
37
38
45
46
47
50 for (
const auto &parser : std::as_const(s_parsers))
51 parser->initializeParser();
55
56
59 for (
const auto parser : s_parsers)
60 parser->terminateParser();
65 for (
const auto parser : std::as_const(s_parsers)) {
66 if (parser->language() == language)
74 QString fileName = QFileInfo(filePath).fileName();
76 for (
const auto &parser : s_parsers) {
77 const QStringList sourcePatterns = parser->sourceFileNameFilter();
78 for (
const QString &pattern : sourcePatterns) {
79 auto re = QRegularExpression::fromWildcard(pattern, Qt::CaseInsensitive);
80 if (re.match(fileName).hasMatch())
88
89
90void CodeParser::extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc)
92 static const QRegularExpression bracedRegExp(
93 QRegularExpression::anchoredPattern(QLatin1String(R"(\{([^{}]*)\}(?:\{([^{}]*)\})?)")));
94 auto match = bracedRegExp.matchView(arg);
95 if (match.hasMatch()) {
96 *link = match.captured(1);
97 *desc = match.captured(2);
101 qsizetype spaceAt = arg.indexOf(QLatin1Char(
' '));
102 if (arg.contains(QLatin1String(
".html")) && spaceAt != -1) {
103 *link = arg.left(spaceAt).trimmed().toString();
104 *desc = arg.mid(spaceAt).trimmed().toString();
106 *link = arg.toString();
113
114
119 extractPageLinkAndDesc(arg, &link, &desc);
120 node->setLink(linkType, link, desc);
124
125
126
127
128
129
130
131
132
135 return (Config::instance().showInternal()
136 || !doc.metaCommandsUsed().contains(QStringLiteral(
"internal")));
virtual void terminateParser()
Terminating a code parser is trivial.
CodeParser()
The constructor adds this code parser to the static list of code parsers.
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 ~CodeParser()
The destructor removes this code parser from the static list of code parsers.
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.
LinkType
An unsigned char value that probably should be moved out of the Node base class.
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static QDocDatabase * qdocDB()
Creates the singleton.
Combined button and popup list for selecting options.