qdoc: Fixed a qdoc error problem

When a page exists in more than one file,
qdoc was reporting this sometimes without
reference to the locations of the files.
This has now been fixed.

Change-Id: I0697acc170b94a74b15fb384556dd76f764f7792
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
This commit is contained in:
Martin Smith 2012-05-10 10:38:42 +02:00 committed by Qt by Nokia
parent 47e6ec0736
commit 3b6b8a0f74
3 changed files with 61 additions and 63 deletions

View File

@ -695,22 +695,34 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
} }
} }
else if (command == COMMAND_EXTERNALPAGE) { else if (command == COMMAND_EXTERNALPAGE) {
return new FakeNode(tree_->root(), arg.first, Node::ExternalPage, Node::ArticlePage); FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::ExternalPage, Node::ArticlePage);
fn->setLocation(arg.second);
return fn;
} }
else if (command == COMMAND_FILE) { else if (command == COMMAND_FILE) {
return new FakeNode(tree_->root(), arg.first, Node::File, Node::NoPageType); FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::File, Node::NoPageType);
fn->setLocation(arg.second);
return fn;
} }
else if (command == COMMAND_GROUP) { else if (command == COMMAND_GROUP) {
return new FakeNode(tree_->root(), arg.first, Node::Group, Node::OverviewPage); FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::Group, Node::OverviewPage);
fn->setLocation(arg.second);
return fn;
} }
else if (command == COMMAND_HEADERFILE) { else if (command == COMMAND_HEADERFILE) {
return new FakeNode(tree_->root(), arg.first, Node::HeaderFile, Node::ApiPage); FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::HeaderFile, Node::ApiPage);
fn->setLocation(arg.second);
return fn;
} }
else if (command == COMMAND_MODULE) { else if (command == COMMAND_MODULE) {
return new FakeNode(tree_->root(), arg.first, Node::Module, Node::OverviewPage); FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::Module, Node::OverviewPage);
fn->setLocation(arg.second);
return fn;
} }
else if (command == COMMAND_QMLMODULE) { else if (command == COMMAND_QMLMODULE) {
return FakeNode::lookupQmlModuleNode(tree_, arg); FakeNode* fn = FakeNode::lookupQmlModuleNode(tree_, arg);
fn->setLocation(arg.second);
return fn;
} }
else if (command == COMMAND_PAGE) { else if (command == COMMAND_PAGE) {
Node::PageType ptype = Node::ArticlePage; Node::PageType ptype = Node::ArticlePage;
@ -758,6 +770,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
} }
else if (command == COMMAND_DITAMAP) { else if (command == COMMAND_DITAMAP) {
FakeNode* fn = new DitaMapNode(tree_->root(), arg.first); FakeNode* fn = new DitaMapNode(tree_->root(), arg.first);
fn->setLocation(arg.second);
return fn; return fn;
} }
else if (command == COMMAND_QMLCLASS) { else if (command == COMMAND_QMLCLASS) {
@ -785,7 +798,9 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
return qcn; return qcn;
} }
else if (command == COMMAND_QMLBASICTYPE) { else if (command == COMMAND_QMLBASICTYPE) {
return new QmlBasicTypeNode(tree_->root(), arg.first); QmlBasicTypeNode* n = new QmlBasicTypeNode(tree_->root(), arg.first);
n->setLocation(arg.second);
return n;
} }
else if ((command == COMMAND_QMLSIGNAL) || else if ((command == COMMAND_QMLSIGNAL) ||
(command == COMMAND_QMLMETHOD) || (command == COMMAND_QMLMETHOD) ||
@ -794,41 +809,33 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
QString module; QString module;
QString element; QString element;
QString type; QString type;
if (splitQmlMethodArg(doc,arg.first,type,module,element)) { if (splitQmlMethodArg(arg.first,type,module,element)) {
QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element); QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element);
if (qmlClass) { if (qmlClass) {
bool attached = false;
Node::Type nodeType = Node::QmlMethod;
if (command == COMMAND_QMLSIGNAL) if (command == COMMAND_QMLSIGNAL)
return makeFunctionNode(doc, nodeType = Node::QmlSignal;
arg.first, else if (command == COMMAND_QMLATTACHEDSIGNAL) {
qmlClass, nodeType = Node::QmlSignal;
Node::QmlSignal, attached = true;
false, }
COMMAND_QMLSIGNAL);
else if (command == COMMAND_QMLATTACHEDSIGNAL)
return makeFunctionNode(doc,
arg.first,
qmlClass,
Node::QmlSignal,
true,
COMMAND_QMLATTACHEDSIGNAL);
else if (command == COMMAND_QMLMETHOD) { else if (command == COMMAND_QMLMETHOD) {
return makeFunctionNode(doc, // do nothing
arg.first,
qmlClass,
Node::QmlMethod,
false,
COMMAND_QMLMETHOD);
} }
else if (command == COMMAND_QMLATTACHEDMETHOD) else if (command == COMMAND_QMLATTACHEDMETHOD)
return makeFunctionNode(doc, attached = true;
arg.
first,
qmlClass,
Node::QmlMethod,
true,
COMMAND_QMLATTACHEDMETHOD);
else else
return 0; // never get here. return 0; // never get here.
FunctionNode* fn = makeFunctionNode(doc,
arg.first,
qmlClass,
nodeType,
attached,
command);
if (fn)
fn->setLocation(arg.second);
return fn;
} }
} }
} }
@ -854,8 +861,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
\note The two elements \e{Component} and \e{QtObject} never \note The two elements \e{Component} and \e{QtObject} never
have a module qualifier. have a module qualifier.
*/ */
bool CppCodeParser::splitQmlPropertyArg(const Doc& doc, bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
const QString& arg,
QString& type, QString& type,
QString& module, QString& module,
QString& element, QString& element,
@ -878,11 +884,11 @@ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
return true; return true;
} }
QString msg = "Unrecognizable QML module/component qualifier for " + arg; QString msg = "Unrecognizable QML module/component qualifier for " + arg;
doc.location().warning(tr(msg.toLatin1().data())); location().warning(tr(msg.toLatin1().data()));
} }
else { else {
QString msg = "Missing property type for " + arg; QString msg = "Missing property type for " + arg;
doc.location().warning(tr(msg.toLatin1().data())); location().warning(tr(msg.toLatin1().data()));
} }
return false; return false;
} }
@ -901,8 +907,7 @@ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
\note The two elements \e{Component} and \e{QtObject} never \note The two elements \e{Component} and \e{QtObject} never
have a module qualifier. have a module qualifier.
*/ */
bool CppCodeParser::splitQmlMethodArg(const Doc& doc, bool CppCodeParser::splitQmlMethodArg(const QString& arg,
const QString& arg,
QString& type, QString& type,
QString& module, QString& module,
QString& element) QString& element)
@ -935,7 +940,7 @@ bool CppCodeParser::splitQmlMethodArg(const Doc& doc,
return true; return true;
} }
QString msg = "Unrecognizable QML module/component qualifier for " + arg; QString msg = "Unrecognizable QML module/component qualifier for " + arg;
doc.location().warning(tr(msg.toLatin1().data())); location().warning(tr(msg.toLatin1().data()));
return false; return false;
} }
@ -945,9 +950,7 @@ bool CppCodeParser::splitQmlMethodArg(const Doc& doc,
Currently, this function is called only for \e{qmlproperty} Currently, this function is called only for \e{qmlproperty}
and \e{qmlattachedproperty}. and \e{qmlattachedproperty}.
*/ */
Node *CppCodeParser::processTopicCommandGroup(const Doc& doc, Node *CppCodeParser::processTopicCommandGroup(const QString& command, const ArgList& args)
const QString& command,
const ArgList& args)
{ {
QmlPropGroupNode* qmlPropGroup = 0; QmlPropGroupNode* qmlPropGroup = 0;
if ((command == COMMAND_QMLPROPERTY) || if ((command == COMMAND_QMLPROPERTY) ||
@ -960,7 +963,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
bool attached = (command == COMMAND_QMLATTACHEDPROPERTY); bool attached = (command == COMMAND_QMLATTACHEDPROPERTY);
ArgList::ConstIterator argsIter = args.begin(); ArgList::ConstIterator argsIter = args.begin();
arg = argsIter->first; arg = argsIter->first;
if (splitQmlPropertyArg(doc,arg,type,module,element,property)) { if (splitQmlPropertyArg(arg,type,module,element,property)) {
QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element); QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element);
if (qmlClass) { if (qmlClass) {
qmlPropGroup = new QmlPropGroupNode(qmlClass,property); //,attached); qmlPropGroup = new QmlPropGroupNode(qmlClass,property); //,attached);
@ -984,7 +987,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
++argsIter; ++argsIter;
while (argsIter != args.end()) { while (argsIter != args.end()) {
arg = argsIter->first; arg = argsIter->first;
if (splitQmlPropertyArg(doc,arg,type,module,element,property)) { if (splitQmlPropertyArg(arg,type,module,element,property)) {
QmlPropertyNode* qmlPropNode = new QmlPropertyNode(qmlPropGroup, QmlPropertyNode* qmlPropNode = new QmlPropertyNode(qmlPropGroup,
property, property,
type, type,
@ -2296,7 +2299,7 @@ bool CppCodeParser::matchDocsAndStuff()
if ((topic == COMMAND_QMLPROPERTY) || if ((topic == COMMAND_QMLPROPERTY) ||
(topic == COMMAND_QMLATTACHEDPROPERTY)) { (topic == COMMAND_QMLATTACHEDPROPERTY)) {
Doc nodeDoc = doc; Doc nodeDoc = doc;
Node *node = processTopicCommandGroup(nodeDoc,topic,args); Node *node = processTopicCommandGroup(topic,args);
if (node != 0) { if (node != 0) {
nodes.append(node); nodes.append(node);
docs.append(nodeDoc); docs.append(nodeDoc);

View File

@ -89,23 +89,16 @@ protected:
virtual Node *processTopicCommand(const Doc& doc, virtual Node *processTopicCommand(const Doc& doc,
const QString& command, const QString& command,
const ArgLocPair& arg); const ArgLocPair& arg);
#ifdef QDOC_QML virtual Node *processTopicCommandGroup(const QString& command, const ArgList& args);
// might need to implement this in QsCodeParser as well. bool splitQmlPropertyArg(const QString& arg,
virtual Node *processTopicCommandGroup(const Doc& doc,
const QString& command,
const ArgList& args);
bool splitQmlPropertyArg(const Doc& doc,
const QString& arg,
QString& type, QString& type,
QString& module, QString& module,
QString& element, QString& element,
QString& name); QString& name);
bool splitQmlMethodArg(const Doc& doc, bool splitQmlMethodArg(const QString& arg,
const QString& arg,
QString& type, QString& type,
QString& module, QString& module,
QString& element); QString& element);
#endif
virtual QSet<QString> otherMetaCommands(); virtual QSet<QString> otherMetaCommands();
virtual void processOtherMetaCommand(const Doc& doc, virtual void processOtherMetaCommand(const Doc& doc,
const QString& command, const QString& command,

View File

@ -430,8 +430,8 @@ static const char* const suffixes[NumSuffixes] = { "", "s", "es" };
/*! /*!
This function searches for a node with the specified \a title. This function searches for a node with the specified \a title.
If \a relative is provided, use it to disambiguate if it has a If \a relative node is provided, it is used to disambiguate if
QML module identifier. it has a QML module identifier.
*/ */
const FakeNode* Tree::findFakeNodeByTitle(const QString& title, const Node* relative ) const const FakeNode* Tree::findFakeNodeByTitle(const QString& title, const Node* relative ) const
{ {
@ -470,14 +470,13 @@ const FakeNode* Tree::findFakeNodeByTitle(const QString& title, const Node* rela
QList<Location> internalLocations; QList<Location> internalLocations;
while (j != priv->fakeNodesByTitle.constEnd()) { while (j != priv->fakeNodesByTitle.constEnd()) {
if (j.key() == i.key() && j.value()->url().isEmpty()) if (j.key() == i.key() && j.value()->url().isEmpty())
internalLocations.append(j.value()->doc().location()); internalLocations.append(j.value()->location());
++j; ++j;
} }
if (internalLocations.size() > 0) { if (internalLocations.size() > 0) {
i.value()->doc().location().warning( i.value()->location().warning(tr("This page exists in more than one file: \"%1\"").arg(title));
tr("Page '%1' defined in more than one location:").arg(title));
foreach (const Location &location, internalLocations) foreach (const Location &location, internalLocations)
location.warning(tr("(defined here)")); location.warning(tr("[It also exists here]"));
} }
} }
return i.value(); return i.value();
@ -601,6 +600,8 @@ NodeMultiMap Tree::groups() const
} }
/*! /*!
This function adds the \a group name to the list of groups
for the \a node name. It also adds the \a node to the \a group.
*/ */
void Tree::addToPublicGroup(Node* node, const QString& group) void Tree::addToPublicGroup(Node* node, const QString& group)
{ {
@ -609,6 +610,7 @@ void Tree::addToPublicGroup(Node* node, const QString& group)
} }
/*! /*!
Returns the public group map.
*/ */
QMultiMap<QString, QString> Tree::publicGroups() const QMultiMap<QString, QString> Tree::publicGroups() const
{ {