qdoc: Add new checkForCollision()
But don't use it yet. qdoc will check for name collisions within a module, once we decide what collisions to look for and what to do about them. This change puts a rewritten checkForCollision() function back in, but doesn't use it yet. Change-Id: I41f9275c3ca29f228268ccf7cb2d99bbe0ce557c Task-number: QTBUG-40506 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>bb10
parent
a5570bbf9a
commit
af7f944dc5
|
|
@ -497,6 +497,15 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
|
|||
ptype = Node::DitaMapPage;
|
||||
}
|
||||
|
||||
#if 0
|
||||
const Node* n = qdb_->checkForCollision(args[0]);
|
||||
if (n) {
|
||||
QString other = n->doc().location().fileName();
|
||||
doc.location().warning(tr("Name/title collision detected: '%1' in '\\%2'")
|
||||
.arg(args[0]).arg(command),
|
||||
tr("Also used here: %1").arg(other));
|
||||
}
|
||||
#endif
|
||||
DocNode* dn = 0;
|
||||
if (ptype == Node::DitaMapPage)
|
||||
dn = new DitaMapNode(qdb_->primaryTreeRoot(), args[0]);
|
||||
|
|
@ -534,6 +543,15 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
|
|||
classNode = qdb_->findClassNode(names[1].split("::"));
|
||||
}
|
||||
|
||||
#if 0
|
||||
const Node* n = qdb_->checkForCollision(names[0]);
|
||||
if (n) {
|
||||
QString other = n->doc().location().fileName();
|
||||
doc.location().warning(tr("Name/title collision detected: '%1' in '\\%2'")
|
||||
.arg(names[0]).arg(command),
|
||||
tr("Also used here: %1").arg(other));
|
||||
}
|
||||
#endif
|
||||
QmlClassNode* qcn = new QmlClassNode(qdb_->primaryTreeRoot(), names[0]);
|
||||
qcn->setClassNode(classNode);
|
||||
qcn->setLocation(doc.startLocation());
|
||||
|
|
|
|||
|
|
@ -304,6 +304,9 @@ class QDocDatabase
|
|||
}
|
||||
FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone);
|
||||
Node* findNodeInOpenNamespace(QStringList& path, Node::Type type);
|
||||
const Node* checkForCollision(const QString& name) {
|
||||
return primaryTree()->checkForCollision(name);
|
||||
}
|
||||
/*******************************************************************/
|
||||
|
||||
/*******************************************************************
|
||||
|
|
|
|||
|
|
@ -1393,4 +1393,13 @@ const Node* Tree::findFunctionNode(const QString& target, const Node* relative,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Search for a node that is identified by \a name.
|
||||
Return a pointer to a matching node, or 0.
|
||||
*/
|
||||
const Node* Tree::checkForCollision(const QString& name)
|
||||
{
|
||||
return findNode(QStringList(name), 0, 0, Node::DontCare);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ class Tree
|
|||
void insertQmlType(const QString& key, QmlClassNode* n);
|
||||
void addExampleNode(ExampleNode* n) { exampleNodeMap_.insert(n->title(), n); }
|
||||
ExampleNodeMap& exampleNodeMap() { return exampleNodeMap_; }
|
||||
const Node* checkForCollision(const QString& name);
|
||||
|
||||
public:
|
||||
const QString& moduleName() const { return module_; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue