diff options
Diffstat (limited to 'src/tools/qdoc/codeparser.cpp')
-rw-r--r-- | src/tools/qdoc/codeparser.cpp | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/src/tools/qdoc/codeparser.cpp b/src/tools/qdoc/codeparser.cpp index a0ea561b28..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, @@ -412,9 +391,9 @@ bool CodeParser::isParsingQdoc() const for an entity that will produce a documentation page will contain an \inmodule command to tell qdoc which module the entity belongs to. - But now that we normally run qdoc on each module in two passes. The - first produces an index file; the second pass generates the docs - after reading all the index files it needs. + But now we normally run qdoc on each module in two passes. The first + produces an index file; the second pass generates the docs after + reading all the index files it needs. This means that all the pages generated during each pass 2 run of qdoc almost certainly belong to a single module, and the name of @@ -431,10 +410,10 @@ bool CodeParser::isParsingQdoc() const void CodeParser::checkModuleInclusion(Node* n) { if (n->moduleName().isEmpty()) { + n->setModuleName(Generator::defaultModuleName()); switch (n->type()) { case Node::Class: if (n->access() != Node::Private && !n->doc().isEmpty()) { - n->setModuleName(Generator::defaultModuleName()); n->doc().location().warning(tr("Class %1 has no \\inmodule command; " "using project name by default: %2") .arg(n->name()).arg(Generator::defaultModuleName())); @@ -442,16 +421,15 @@ void CodeParser::checkModuleInclusion(Node* n) break; case Node::Namespace: if (n->access() != Node::Private && !n->name().isEmpty() && !n->doc().isEmpty()) { - n->setModuleName(Generator::defaultModuleName()); n->doc().location().warning(tr("Namespace %1 has no \\inmodule command; " "using project name by default: %2") .arg(n->name()).arg(Generator::defaultModuleName())); } break; +#if 0 case Node::Document: if (n->access() != Node::Private && !n->doc().isEmpty()) { if (n->subType() == Node::HeaderFile) { - n->setModuleName(Generator::defaultModuleName()); #if 0 n->doc().location().warning(tr("Header file with title \"%1\" has no \\inmodule command; " "using project name by default: %2") @@ -459,7 +437,6 @@ void CodeParser::checkModuleInclusion(Node* n) #endif } else if (n->subType() == Node::Page) { - n->setModuleName(Generator::defaultModuleName()); #if 0 n->doc().location().warning(tr("Page with title \"%1\" has no \\inmodule command; " "using project name by default: %2") @@ -467,7 +444,6 @@ void CodeParser::checkModuleInclusion(Node* n) #endif } else if (n->subType() == Node::Example) { - n->setModuleName(Generator::defaultModuleName()); #if 0 n->doc().location().warning(tr("Example with title \"%1\" has no \\inmodule command; " "using project name by default: %2") @@ -476,6 +452,7 @@ void CodeParser::checkModuleInclusion(Node* n) } } break; +#endif default: break; } |