doc: Remove "current child" code
The current child concept was added to the Name Collision Node to heuristically provide better linking when a link operation reached a collision node. It is doubtful that this improved linking much, but now that qdoc uses multiple trees, it is much less likely that collision nodes will occur. In fact, there are none in in the current Qt5. Therefore, the current child code is hereby removed from qdoc. Task-number: QTBUG-37067 Change-Id: I33aea5d550afb7ceaf941d49112e02c21d44f6dc Reviewed-by: Martin Smith <martin.smith@digia.com>bb10
parent
a9d75c8eb8
commit
c55d437d29
|
|
@ -264,7 +264,6 @@ void CppCodeParser::doneParsingHeaderFiles()
|
|||
*/
|
||||
void CppCodeParser::doneParsingSourceFiles()
|
||||
{
|
||||
qdb_->primaryTreeRoot()->clearCurrentChildPointers();
|
||||
qdb_->primaryTreeRoot()->normalizeOverloads();
|
||||
qdb_->fixInheritance();
|
||||
qdb_->resolveProperties();
|
||||
|
|
|
|||
|
|
@ -6080,7 +6080,6 @@ void DitaXmlGenerator::generateCollisionPages()
|
|||
if (collisions.size() <= 1)
|
||||
continue;
|
||||
|
||||
ncn->clearCurrentChild();
|
||||
beginSubPage(ncn, Generator::fileName(ncn));
|
||||
QString fullTitle = ncn->fullTitle();
|
||||
QString ditaTitle = fullTitle;
|
||||
|
|
|
|||
|
|
@ -312,24 +312,14 @@ QString Generator::fileBase(const Node *node) const
|
|||
node = node->parent();
|
||||
}
|
||||
|
||||
if (node->type() == Node::Document && node->subType() == Node::Collision) {
|
||||
const NameCollisionNode* ncn = static_cast<const NameCollisionNode*>(node);
|
||||
if (ncn->currentChild())
|
||||
return fileBase(ncn->currentChild());
|
||||
}
|
||||
|
||||
if (node->hasBaseName())
|
||||
return node->baseName();
|
||||
|
||||
QString base;
|
||||
if (node->isDocNode()) {
|
||||
base = node->name();
|
||||
if (node->subType() == Node::Collision) {
|
||||
const NameCollisionNode* ncn = static_cast<const NameCollisionNode*>(node);
|
||||
if (ncn->currentChild())
|
||||
return fileBase(ncn->currentChild());
|
||||
if (node->subType() == Node::Collision)
|
||||
base.prepend("collision-");
|
||||
}
|
||||
//Was QDOC2_COMPAT, required for index.html
|
||||
if (base.endsWith(".html"))
|
||||
base.truncate(base.length() - 5);
|
||||
|
|
|
|||
|
|
@ -1353,7 +1353,6 @@ void HtmlGenerator::generateCollisionPages()
|
|||
if (collisions.size() <= 1)
|
||||
continue;
|
||||
|
||||
ncn->clearCurrentChild();
|
||||
beginSubPage(ncn, Generator::fileName(ncn));
|
||||
QString fullTitle = ncn->fullTitle();
|
||||
QString htmlTitle = fullTitle;
|
||||
|
|
@ -1513,7 +1512,6 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
|
|||
out() << "</ul>\n";
|
||||
}
|
||||
else if (dn->subType() == Node::QmlClass) {
|
||||
const_cast<DocNode*>(dn)->setCurrentChild();
|
||||
ClassNode* cn = qml_cn->classNode();
|
||||
generateBrief(qml_cn, marker);
|
||||
generateQmlRequisites(qml_cn, marker);
|
||||
|
|
@ -1558,7 +1556,6 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
|
|||
++s;
|
||||
}
|
||||
generateFooter(dn);
|
||||
const_cast<DocNode*>(dn)->clearCurrentChild();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -922,19 +922,6 @@ void InnerNode::makeUndocumentedChildrenInternal()
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
In each child node that is a collision node,
|
||||
clear the current child pointer.
|
||||
*/
|
||||
void InnerNode::clearCurrentChildPointers()
|
||||
{
|
||||
foreach (Node* child, childNodes()) {
|
||||
if (child->subType() == Collision) {
|
||||
child->clearCurrentChild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
void InnerNode::normalizeOverloads()
|
||||
|
|
@ -2161,38 +2148,6 @@ QString QmlClassNode::qmlFullBaseName() const
|
|||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
The name of this QML class node might be the same as the
|
||||
name of some other QML class node. If so, then this node's
|
||||
parent will be a NameCollisionNode.This function sets the
|
||||
NameCollisionNode's current child to this node. This is
|
||||
important when outputting the documentation for this node,
|
||||
when, for example, the documentation contains a link to
|
||||
the page being output. We don't want to generate a link
|
||||
to the disambiguation page if we can avoid it, and to be
|
||||
able to avoid it, the NameCollisionNode must maintain the
|
||||
current child pointer. That's the purpose of this function.
|
||||
*/
|
||||
void QmlClassNode::setCurrentChild()
|
||||
{
|
||||
if (parent()) {
|
||||
InnerNode* n = parent();
|
||||
if (n->subType() == Node::Collision)
|
||||
n->setCurrentChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
void QmlClassNode::clearCurrentChild()
|
||||
{
|
||||
if (parent()) {
|
||||
InnerNode* n = parent();
|
||||
if (n->subType() == Node::Collision)
|
||||
n->clearCurrentChild();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
If the QML type's QML module pointer is set, return the QML
|
||||
module name from the QML module node. Otherwise, return the
|
||||
|
|
@ -2390,7 +2345,6 @@ NameCollisionNode::NameCollisionNode(InnerNode* child)
|
|||
{
|
||||
setTitle("Name Collision: " + child->name());
|
||||
addCollision(child);
|
||||
current = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -2416,28 +2370,11 @@ NameCollisionNode::~NameCollisionNode()
|
|||
// nothing.
|
||||
}
|
||||
|
||||
/*! \fn const InnerNode* NameCollisionNode::currentChild() const
|
||||
Returns a pointer to the current child, which may be 0.
|
||||
*/
|
||||
|
||||
/*! \fn void NameCollisionNode::setCurrentChild(InnerNode* child)
|
||||
Sets the current child to \a child. The current child is
|
||||
valid only within the file where it is defined.
|
||||
*/
|
||||
|
||||
/*! \fn void NameCollisionNode::clearCurrentChild()
|
||||
Sets the current child to 0. This should be called at the
|
||||
end of each file, because the current child is only valid
|
||||
within the file where the child is defined.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns \c true if this collision node's current node is a QML node.
|
||||
*/
|
||||
bool NameCollisionNode::isQmlNode() const
|
||||
{
|
||||
if (current)
|
||||
return current->isQmlNode();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2447,10 +2384,6 @@ bool NameCollisionNode::isQmlNode() const
|
|||
*/
|
||||
InnerNode* NameCollisionNode::findAny(Node::Type t, Node::SubType st)
|
||||
{
|
||||
if (current) {
|
||||
if (current->type() == t && current->subType() == st)
|
||||
return current;
|
||||
}
|
||||
const NodeList& cn = childNodes();
|
||||
NodeList::ConstIterator i = cn.constBegin();
|
||||
while (i != cn.constEnd()) {
|
||||
|
|
|
|||
|
|
@ -297,7 +297,6 @@ public:
|
|||
virtual void setQmlModule(QmlModuleNode* ) { }
|
||||
virtual ClassNode* classNode() { return 0; }
|
||||
virtual void setClassNode(ClassNode* ) { }
|
||||
virtual void clearCurrentChild() { }
|
||||
virtual const Node* applyModuleName(const Node* ) const { return 0; }
|
||||
virtual QString idNumber() { return "0"; }
|
||||
QmlClassNode* qmlClassNode();
|
||||
|
|
@ -363,7 +362,6 @@ public:
|
|||
void setOverload(const FunctionNode* func, bool overlode);
|
||||
void normalizeOverloads();
|
||||
void makeUndocumentedChildrenInternal();
|
||||
void clearCurrentChildPointers();
|
||||
void deleteChildren();
|
||||
void removeFromRelated();
|
||||
|
||||
|
|
@ -382,8 +380,6 @@ public:
|
|||
QStringList secondaryKeys();
|
||||
const QStringList& pageKeywords() const { return pageKeywds; }
|
||||
virtual void addPageKeywords(const QString& t) { pageKeywds << t; }
|
||||
virtual void setCurrentChild() { }
|
||||
virtual void setCurrentChild(InnerNode* ) { }
|
||||
virtual void setOutputFileName(const QString& f) { outputFileName_ = f; }
|
||||
virtual QString outputFileName() const { return outputFileName_; }
|
||||
virtual QmlPropertyNode* hasQmlProperty(const QString& ) const;
|
||||
|
|
@ -538,9 +534,6 @@ class NameCollisionNode : public DocNode
|
|||
public:
|
||||
NameCollisionNode(InnerNode* child);
|
||||
~NameCollisionNode();
|
||||
const InnerNode* currentChild() const { return current; }
|
||||
virtual void setCurrentChild(InnerNode* child) { current = child; }
|
||||
virtual void clearCurrentChild() { current = 0; }
|
||||
virtual bool isQmlNode() const;
|
||||
virtual bool isCollisionNode() const { return true; }
|
||||
virtual const Node* applyModuleName(const Node* origin) const;
|
||||
|
|
@ -551,7 +544,6 @@ public:
|
|||
void addLinkTarget(const QString& t, const QString& v) { targets.insert(t,v); }
|
||||
|
||||
private:
|
||||
InnerNode* current;
|
||||
QMap<QString,QString> targets;
|
||||
};
|
||||
|
||||
|
|
@ -598,8 +590,6 @@ public:
|
|||
virtual bool isQtQuickNode() const { return (qmlModuleName() == QLatin1String("QtQuick")); }
|
||||
virtual ClassNode* classNode() { return cnode_; }
|
||||
virtual void setClassNode(ClassNode* cn) { cnode_ = cn; }
|
||||
virtual void setCurrentChild();
|
||||
virtual void clearCurrentChild();
|
||||
virtual bool isAbstract() const { return abstract_; }
|
||||
virtual bool isWrapper() const { return wrapper_; }
|
||||
virtual void setAbstract(bool b) { abstract_ = b; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue