From 14f7eb86ca2275d91f284279af5f77205d4ae3c0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 13 Sep 2012 11:38:45 +0200 Subject: qdoc: Refactoring of qdoc data structures 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 Reviewed-by: Lars Knoll Reviewed-by: Jerome Pasion --- src/tools/qdoc/codeparser.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'src/tools/qdoc/codeparser.cpp') diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp index dbbb20ccfe0..134b2f26166 100644 --- a/src/tools/qdoc/codeparser.cpp +++ b/src/tools/qdoc/codeparser.cpp @@ -48,6 +48,7 @@ #include "tree.h" #include "config.h" #include "generator.h" +#include "qdocdatabase.h" #include QT_BEGIN_NAMESPACE @@ -81,6 +82,7 @@ QMap CodeParser::nameToTitle; */ CodeParser::CodeParser() { + qdb_ = QDocDatabase::qdocDB(); parsers.prepend(this); } @@ -114,16 +116,14 @@ QStringList CodeParser::headerFileNameFilter() return sourceFileNameFilter(); } -void CodeParser::parseHeaderFile(const Location& location, - const QString& filePath, - Tree *tree) +void CodeParser::parseHeaderFile(const Location& location, const QString& filePath) { - parseSourceFile(location, filePath, tree); + parseSourceFile(location, filePath); } -void CodeParser::doneParsingHeaderFiles(Tree *tree) +void CodeParser::doneParsingHeaderFiles() { - doneParsingSourceFiles(tree); + doneParsingSourceFiles(); } /*! @@ -230,8 +230,7 @@ QSet CodeParser::commonMetaCommands() void CodeParser::processCommonMetaCommand(const Location& location, const QString& command, const ArgLocPair& arg, - Node* node, - Tree* tree) + Node* node) { if (command == COMMAND_COMPAT) { location.warning(tr("\\compat command used, but Qt3 compatibility is no longer supported")); @@ -241,21 +240,16 @@ void CodeParser::processCommonMetaCommand(const Location& location, node->setStatus(Node::Deprecated); } else if (command == COMMAND_INGROUP) { - tree->addToGroup(node, arg.first); + qdb_->addToGroup(node, arg.first); } else if (command == COMMAND_INPUBLICGROUP) { - tree->addToPublicGroup(node, arg.first); + qdb_->addToPublicGroup(node, arg.first); } else if (command == COMMAND_INMODULE) { - node->setModuleName(arg.first); + qdb_->addToModule(arg.first,node); } else if (command == COMMAND_INQMLMODULE) { - node->setQmlModule(arg); - DocNode* fn = DocNode::lookupQmlModuleNode(tree, arg); - fn->addQmlModuleMember(node); - QString qmid = node->qmlModuleIdentifier(); - QmlClassNode* qcn = static_cast(node); - QmlClassNode::insertQmlModuleMember(qmid, qcn); + qdb_->addToQmlModule(arg.first,node); } else if (command == COMMAND_MAINCLASS) { node->setStatus(Node::Main); -- cgit v1.2.3