diff options
Diffstat (limited to 'tools/qdoc3/tree.cpp')
-rw-r--r-- | tools/qdoc3/tree.cpp | 162 |
1 files changed, 9 insertions, 153 deletions
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 5972b9f..eec6578 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -1226,7 +1226,7 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer, QString fullName = fullDocumentName(node); if (fullName != objName) writer.writeAttribute("fullname", fullName); - writer.writeAttribute("href", fullDocumentLocation(node)); + writer.writeAttribute("href", HtmlGenerator::fullDocumentLocation(node)); if ((node->type() != Node::Fake) && (!node->isQmlNode())) writer.writeAttribute("location", node->location().fileName()); @@ -1364,6 +1364,8 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer, { const QmlPropertyNode *qpn = static_cast<const QmlPropertyNode*>(node); writer.writeAttribute("type", qpn->dataType()); + writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false"); + writer.writeAttribute("writable", qpn->isWritable(this) ? "true" : "false"); } break; case Node::Property: @@ -1667,7 +1669,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer, if (node->type() == Node::Class) { writer.writeTextElement("name", fullDocumentName(node)); - writer.writeTextElement("filename", fullDocumentLocation(node)); + writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node)); // Classes contain information about their base classes. const ClassNode *classNode = static_cast<const ClassNode*>(node); @@ -1685,7 +1687,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer, generateTagFileCompounds(writer, static_cast<const InnerNode *>(node)); } else { writer.writeTextElement("name", fullDocumentName(node)); - writer.writeTextElement("filename", fullDocumentLocation(node)); + writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node)); // Recurse to write all members. generateTagFileMembers(writer, static_cast<const InnerNode *>(node)); @@ -1806,7 +1808,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, "virtual " + functionNode->returnType()); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); @@ -1846,7 +1848,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, const PropertyNode *propertyNode = static_cast<const PropertyNode*>(node); writer.writeAttribute("type", propertyNode->dataType()); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); @@ -1858,7 +1860,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, { const EnumNode *enumNode = static_cast<const EnumNode*>(node); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); writer.writeEndElement(); // member @@ -1882,7 +1884,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, else writer.writeAttribute("type", ""); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); @@ -1934,152 +1936,6 @@ void Tree::addExternalLink(const QString &url, const Node *relative) } /*! - Returns the full document location for HTML-based documentation. - This should be moved into the HTML generator. - */ -QString Tree::fullDocumentLocation(const Node *node) const -{ - if (!node) - return ""; - if (!node->url().isEmpty()) - return node->url(); - - QString parentName; - QString anchorRef; - - 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) { -#ifdef QDOC_QML - if ((node->subType() == Node::QmlClass) || - (node->subType() == Node::QmlBasicType)) { - QString fb = node->fileBase(); - if (fb.startsWith(QLatin1String("qml-"))) - return fb + ".html"; - else - return "qml-" + node->fileBase() + ".html"; - } else -#endif - 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 = parentName.replace(".html", "") + "-" - + 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 = "#" + functionNode->name() - + "-" + QString::number(functionNode->overloadNumber()); - else - anchorRef = "#" + 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 = "#" + node->name() + "-enum"; - break; - case Node::Typedef: - anchorRef = "#" + node->name() + "-typedef"; - break; - case Node::Property: - anchorRef = "#" + node->name() + "-prop"; - break; - case Node::QmlProperty: - anchorRef = "#" + node->name() + "-prop"; - break; - case Node::QmlSignal: - anchorRef = "#" + node->name() + "-signal"; - break; - case Node::QmlMethod: - anchorRef = "#" + node->name() + "-method"; - break; - case Node::Variable: - anchorRef = "#" + node->name() + "-var"; - break; - case Node::Target: - anchorRef = "#" + Doc::canonicalTitle(node->name()); - 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("/", "-").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", "-qt3.html"); - break; - case Node::Obsolete: - parentName.replace(".html", "-obsolete.html"); - break; - default: - ; - } - } - - return parentName.toLower() + anchorRef; -} - -/*! Construct the full document name for \a node and return the name. */ |