diff options
author | Martin Smith <martin.smith@digia.com> | 2014-02-24 13:12:08 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-31 21:05:00 +0200 |
commit | a9d75c8eb86bd0fa68384091c1f0b02319146ae4 (patch) | |
tree | ef84525df16d1fdd6705f37c577af598c73de8e1 /src/tools/qdoc/codeparser.cpp | |
parent | 5fecc6512f0e869713658502674665f9077cc340 (diff) |
qdoc: Teach qdoc to use multiple trees (part 3)
With this update, qdoc is now ready for testing
with multiple trees. In making this change to using
multiple trees, it has become clear that qdoc does
not really need trees the way it currently uses them.
Each C++ class or namespace, or QML type is naturally
a tree tree structure, but above that level, what we
currently call a tree in qdoc should really be called
a collection of maps. This change has moved qdoc in
that direction. It remains to replace the Tree class
with a class that encapsulates a set of maps, one for
each major node type. That can be implemented later.
Task-number: QTBUG-35377
Change-Id: I39068a0cb26c01f14ec0e4621742d727efb913bf
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/codeparser.cpp')
-rw-r--r-- | src/tools/qdoc/codeparser.cpp | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp index 5811dc8afc..e25056e353 100644 --- a/src/tools/qdoc/codeparser.cpp +++ b/src/tools/qdoc/codeparser.cpp @@ -76,7 +76,6 @@ QT_BEGIN_NAMESPACE QString CodeParser::currentSubDir_; QList<CodeParser *> CodeParser::parsers; bool CodeParser::showInternal = false; -QMap<QString,QString> CodeParser::nameToTitle; /*! The constructor adds this code parser to the static @@ -300,50 +299,30 @@ void CodeParser::processCommonMetaCommand(const Location& location, else if (command == COMMAND_PAGEKEYWORDS) { node->addPageKeywords(arg.first); } - else if (command == COMMAND_SUBTITLE) { - if (node->type() == Node::Document) { - DocNode *dn = static_cast<DocNode *>(node); - dn->setSubTitle(arg.first); - } - else - location.warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE)); - } else if (command == COMMAND_THREADSAFE) { node->setThreadSafeness(Node::ThreadSafe); } else if (command == COMMAND_TITLE) { - if (node->type() == Node::Document) { - DocNode *dn = static_cast<DocNode *>(node); - dn->setTitle(arg.first); - if (dn->subType() == Node::Example) { - ExampleNode::exampleNodeMap.insert(dn->title(),static_cast<ExampleNode*>(dn)); - } - nameToTitle.insert(dn->name(),arg.first); - } - else - location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE)); + node->setTitle(arg.first); + if (!node->isDocNode() && !node->isCollectionNode()) + location.warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE)); + else if (node->isExample()) + qdb_->addExampleNode(static_cast<ExampleNode*>(node)); + } + else if (command == COMMAND_SUBTITLE) { + node->setSubTitle(arg.first); + if (!node->isDocNode() && !node->isCollectionNode()) + location.warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE)); } else if (command == COMMAND_QTVARIABLE) { - if (node->subType() == Node::Module) { - DocNode *dn = static_cast<DocNode *>(node); - dn->setQtVariable(arg.first); - } - else - location.warning(tr("Command '\\%1' found outside of '\\module'. It can only be used within a module page.") + node->setQtVariable(arg.first); + if (!node->isModule() && !node->isQmlModule()) + location.warning(tr("Command '\\%1' is only meanigfule in '\\module' and '\\qmlmodule'.") .arg(COMMAND_QTVARIABLE)); } } /*! - Find the page title given the page \a name and return it. - */ -const QString CodeParser::titleFromName(const QString& name) -{ - const QString t = nameToTitle.value(name); - return t; -} - -/*! \internal */ void CodeParser::extractPageLinkAndDesc(const QString& arg, |