diff options
author | Martin Smith <martin.smith@nokia.com> | 2012-09-13 11:38:45 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-14 15:23:15 +0200 |
commit | 14f7eb86ca2275d91f284279af5f77205d4ae3c0 (patch) | |
tree | ed4e91d6422dd814ac3e81739ad4a3b55bf050c7 /src/tools/qdoc/qmlvisitor.cpp | |
parent | 817a4474676b30a964de476d26bd70ddba3d379a (diff) |
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 <qt_docbot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
Diffstat (limited to 'src/tools/qdoc/qmlvisitor.cpp')
-rw-r--r-- | src/tools/qdoc/qmlvisitor.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index 14312df63a..d985e33ba2 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -49,6 +49,7 @@ #include "node.h" #include "codeparser.h" #include "qmlvisitor.h" +#include "qdocdatabase.h" QT_BEGIN_NAMESPACE @@ -84,7 +85,6 @@ QT_BEGIN_NAMESPACE QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, QQmlJS::Engine *engine, - Tree *tree, QSet<QString> &commands, QSet<QString> &topics) : nestingLevel(0) @@ -93,10 +93,9 @@ QmlDocVisitor::QmlDocVisitor(const QString &filePath, this->name = QFileInfo(filePath).baseName(); document = code; this->engine = engine; - this->tree = tree; this->commands = commands; this->topics = topics; - current = tree->root(); + current = QDocDatabase::qdocDB()->treeRoot(); } /*! @@ -235,6 +234,8 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, Node* node, Doc& doc) { + QDocDatabase* qdb = QDocDatabase::qdocDB(); + const TopicList& topicsUsed = doc.topicsUsed(); if (topicsUsed.size() > 0) { if (node->type() == Node::QmlProperty) { @@ -317,12 +318,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, node->setStatus(Node::Deprecated); } else if (command == COMMAND_INQMLMODULE) { - node->setQmlModule(args[0]); - DocNode* dn = DocNode::lookupQmlModuleNode(tree, args[0]); - dn->addQmlModuleMember(node); - QString qmid = node->qmlModuleIdentifier(); - QmlClassNode* qcn = static_cast<QmlClassNode*>(node); - QmlClassNode::insertQmlModuleMember(qmid, qcn); + qdb->addToQmlModule(args[0].first,node); } else if (command == COMMAND_QMLINHERITS) { if (node->name() == args[0].first) @@ -349,7 +345,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, else if ((command == COMMAND_INGROUP) && !args.isEmpty()) { ArgList::ConstIterator argsIter = args.constBegin(); while (argsIter != args.constEnd()) { - tree->addToGroup(node, argsIter->first); + QDocDatabase::qdocDB()->addToGroup(node, argsIter->first); ++argsIter; } } @@ -380,10 +376,10 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, } /*! - Begin the visit of the object \a definition, recording it in a tree - structure. Increment the object nesting level, which is used to - test whether we are at the public API level. The public level is - level 1. + Begin the visit of the object \a definition, recording it in the + qdoc database. Increment the object nesting level, which is used + to test whether we are at the public API level. The public level + is level 1. */ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition) { |