diff options
author | Paul Wicking <paul.wicking@qt.io> | 2023-03-10 07:55:46 +0100 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2023-03-10 18:09:17 +0100 |
commit | 4546506877d9e5f78d3c3ff13fc9eff77bc84a4e (patch) | |
tree | d342f572b2b87fb559f65295c5f234b01d6504b9 | |
parent | 4814f1655b410f113ae7381e565f50c3e5a41469 (diff) | |
download | qttools-4546506877d9e5f78d3c3ff13fc9eff77bc84a4e.tar.gz |
QDoc: Remove CodeParser::s_showInternal member and associated getter
Get rid of the static CodeParser::s_showInternal member, because there's
no reason for the CodeParser to have a static member that tracks whether
the config is set to showInternal, when the config already carries that
information around. Most of the derived CodeParsers already keep a
reference to the config anyway. Get rid of it, as it is unnecessary.
Task-number: QTBUG-111686
Change-Id: If658282b1c198e48dd236dc6b9eac280e2a5890e
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
-rw-r--r-- | src/qdoc/codeparser.cpp | 5 | ||||
-rw-r--r-- | src/qdoc/codeparser.h | 2 | ||||
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 6 |
3 files changed, 5 insertions, 8 deletions
diff --git a/src/qdoc/codeparser.cpp b/src/qdoc/codeparser.cpp index 3c1ceabd1..31024195c 100644 --- a/src/qdoc/codeparser.cpp +++ b/src/qdoc/codeparser.cpp @@ -13,7 +13,6 @@ QT_BEGIN_NAMESPACE QList<CodeParser *> CodeParser::s_parsers; -bool CodeParser::s_showInternal = false; /*! The constructor adds this code parser to the static @@ -39,7 +38,6 @@ CodeParser::~CodeParser() */ void CodeParser::initializeParser() { - s_showInternal = Config::instance().showInternal(); } /*! @@ -162,7 +160,8 @@ void CodeParser::setLink(Node *node, Node::LinkType linkType, const QString &arg */ bool CodeParser::isWorthWarningAbout(const Doc &doc) { - return (s_showInternal || !doc.metaCommandsUsed().contains(QStringLiteral("internal"))); + return (Config::instance().showInternal() + || !doc.metaCommandsUsed().contains(QStringLiteral("internal"))); } /*! diff --git a/src/qdoc/codeparser.h b/src/qdoc/codeparser.h index 17fd43574..781032b01 100644 --- a/src/qdoc/codeparser.h +++ b/src/qdoc/codeparser.h @@ -45,13 +45,11 @@ public: protected: const QSet<QString> &commonMetaCommands(); static void extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc); - static bool showInternal() { return s_showInternal; } QString m_moduleHeader {}; QDocDatabase *m_qdb {}; private: static QList<CodeParser *> s_parsers; - static bool s_showInternal; }; #define COMMAND_ABSTRACT QLatin1String("abstract") diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 01f044b8e..97982a782 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -587,7 +587,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command, if (!node->isInternal()) node->setStatus(Node::Preliminary); } else if (command == COMMAND_INTERNAL) { - if (!showInternal()) + if (!Config::instance().showInternal()) node->markInternal(); } else if (command == COMMAND_REENTRANT) { node->setThreadSafeness(Node::Reentrant); @@ -874,7 +874,7 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL Node *node = nullptr; if (args.size() == 1) { if (topic == COMMAND_FN) { - if (showInternal() || !doc.isInternal()) + if (Config::instance().showInternal() || !doc.isInternal()) node = parserForLanguage("Clang")->parseFnArg(doc.location(), args[0].first, args[0].second); } else if (topic == COMMAND_MACRO) { node = parseMacroArg(doc.location(), args[0].first); @@ -894,7 +894,7 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL for (const auto &arg : std::as_const(args)) { node = nullptr; if (topic == COMMAND_FN) { - if (showInternal() || !doc.isInternal()) + if (Config::instance().showInternal() || !doc.isInternal()) node = parserForLanguage("Clang")->parseFnArg(doc.location(), arg.first, arg.second); } else if (topic == COMMAND_MACRO) { node = parseMacroArg(doc.location(), arg.first); |