diff options
author | Casper van Donderen <casper.vandonderen@nokia.com> | 2012-04-19 12:19:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-19 13:26:51 +0200 |
commit | c4e308d3f7ad8f2bc6c8e88a89acd1f95a5b46c6 (patch) | |
tree | a48c953fc0524618bfd827594b6611b6c4e432ea /src/tools/qdoc/htmlgenerator.cpp | |
parent | 4de95586f1ecbdc1fad82a75bf4ea7ede8105cf8 (diff) |
QDoc: Generate index file for DITAXML.
This change moves the fullDocumentLocation function to the generator
base-class and adds generateIndex to the DITAXML Generator.
All function calls to fullDocumentLocation are now handled by the static
function in the base-class which will use the file extension from the
currently active generator (either DITAXML or HTML).
Change-Id: I24ce09c05a63eb5980b1243c58990e7ce9d42036
Reviewed-by: Martin Smith <martin.smith@nokia.com>
Diffstat (limited to 'src/tools/qdoc/htmlgenerator.cpp')
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 174 |
1 files changed, 5 insertions, 169 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 24dd31e0b5..7d9f3c00be 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1690,7 +1690,7 @@ void HtmlGenerator::generateFakeNode(FakeNode* fake, CodeMarker* marker) /*! Returns "html" for this subclass of Generator. */ -QString HtmlGenerator::fileExtension(const Node * /* node */) const +QString HtmlGenerator::fileExtension() const { return "html"; } @@ -2110,7 +2110,7 @@ QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, if (sections.isEmpty()) return QString(); - QString fileName = fileBase(inner) + "-members." + fileExtension(inner); + QString fileName = fileBase(inner) + "-members." + fileExtension(); beginSubPage(inner, fileName); QString title = "List of All Members for " + inner->name(); generateHeader(title, inner, marker); @@ -2142,7 +2142,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn, if (sections.isEmpty()) return QString(); - QString fileName = fileBase(qml_cn) + "-members." + fileExtension(qml_cn); + QString fileName = fileBase(qml_cn) + "-members." + fileExtension(); beginSubPage(qml_cn, fileName); QString title = "List of All Members for " + qml_cn->name(); generateHeader(title, qml_cn, marker); @@ -2181,11 +2181,11 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, if (status == CodeMarker::Compat) { title = "Compatibility Members for " + inner->name(); - fileName = fileBase(inner) + "-compat." + fileExtension(inner); + fileName = fileBase(inner) + "-compat." + fileExtension(); } else { title = "Obsolete Members for " + inner->name(); - fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); + fileName = fileBase(inner) + "-obsolete." + fileExtension(); } beginSubPage(inner, fileName); @@ -4319,170 +4319,6 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType } } -/*! - Returns the full document location for HTML-based documentation. - */ -QString HtmlGenerator::fullDocumentLocation(const Node *node, bool subdir) -{ - if (!node) - return ""; - if (!node->url().isEmpty()) - return node->url(); - - QString parentName; - QString anchorRef; - QString fdl = ""; - - /* - If the output is being sent to subdirectories of the - output directory, and if the subdir parameter is set, - prepend the subdirectory name + '/' to the result. - */ - if (subdir) { - fdl = node->outputSubdirectory(); - if (!fdl.isEmpty()) - fdl.append(QLatin1Char('/')); - } - if (node->type() == Node::Namespace) { - - // The root namespace has no name - check for this before creating - // an attribute containing the location of any documentation. - - if (!node->fileBase().isEmpty()) - parentName = node->fileBase() + ".html"; - else - return ""; - } - else if (node->type() == Node::Fake) { - if ((node->subType() == Node::QmlClass) || - (node->subType() == Node::QmlBasicType)) { - QString fb = node->fileBase(); - if (fb.startsWith(Generator::outputPrefix(QLatin1String("QML")))) - return fb + ".html"; - else { - QString mq = ""; - if (!node->qmlModuleName().isEmpty()) { - mq = node->qmlModuleIdentifier().replace(QChar('.'),QChar('-')); - mq = mq.toLower() + "-"; - } - return fdl+ Generator::outputPrefix(QLatin1String("QML")) + mq + - node->fileBase() + QLatin1String(".html"); - } - } - else - parentName = node->fileBase() + ".html"; - } - else if (node->fileBase().isEmpty()) - return ""; - - Node *parentNode = 0; - - if ((parentNode = node->relates())) { - parentName = fullDocumentLocation(node->relates()); - } - else if ((parentNode = node->parent())) { - if (parentNode->subType() == Node::QmlPropertyGroup) { - parentNode = parentNode->parent(); - parentName = fullDocumentLocation(parentNode); - } - else - parentName = fullDocumentLocation(node->parent()); - } - - switch (node->type()) { - case Node::Class: - case Node::Namespace: - if (parentNode && !parentNode->name().isEmpty()) { - parentName.remove(".html"); - parentName += QLatin1Char('-') - + node->fileBase().toLower() + ".html"; - } else { - parentName = node->fileBase() + ".html"; - } - break; - case Node::Function: - { - /* - Functions can be destructors, overloaded, or - have associated properties. - */ - const FunctionNode *functionNode = - static_cast<const FunctionNode *>(node); - - if (functionNode->metaness() == FunctionNode::Dtor) - anchorRef = "#dtor." + functionNode->name().mid(1); - - else if (functionNode->associatedProperty()) - return fullDocumentLocation(functionNode->associatedProperty()); - - else if (functionNode->overloadNumber() > 1) - anchorRef = QLatin1Char('#') + functionNode->name() - + "-" + QString::number(functionNode->overloadNumber()); - else - anchorRef = QLatin1Char('#') + functionNode->name(); - } - - /* - Use node->name() instead of node->fileBase() as - the latter returns the name in lower-case. For - HTML anchors, we need to preserve the case. - */ - break; - case Node::Enum: - anchorRef = QLatin1Char('#') + node->name() + "-enum"; - break; - case Node::Typedef: - anchorRef = QLatin1Char('#') + node->name() + "-typedef"; - break; - case Node::Property: - anchorRef = QLatin1Char('#') + node->name() + "-prop"; - break; - case Node::QmlProperty: - anchorRef = QLatin1Char('#') + node->name() + "-prop"; - break; - case Node::QmlSignal: - anchorRef = QLatin1Char('#') + node->name() + "-signal"; - break; - case Node::QmlSignalHandler: - anchorRef = QLatin1Char('#') + node->name() + "-signal-handler"; - break; - case Node::QmlMethod: - anchorRef = QLatin1Char('#') + node->name() + "-method"; - break; - case Node::Variable: - anchorRef = QLatin1Char('#') + node->name() + "-var"; - break; - case Node::Fake: - { - /* - Use node->fileBase() for fake nodes because they are represented - by pages whose file names are lower-case. - */ - parentName = node->fileBase(); - parentName.replace(QLatin1Char('/'), "-").replace(".", "-"); - parentName += ".html"; - } - break; - default: - break; - } - - // Various objects can be compat (deprecated) or obsolete. - if (node->type() != Node::Class && node->type() != Node::Namespace) { - switch (node->status()) { - case Node::Compat: - parentName.replace(".html", "-compat.html"); - break; - case Node::Obsolete: - parentName.replace(".html", "-obsolete.html"); - break; - default: - ; - } - } - - return fdl + parentName.toLower() + anchorRef; -} /*! This function outputs one or more manifest files in XML. |