summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-11-10 12:38:13 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-11-11 18:08:08 (GMT)
commit2b84cad7c8024984de69717fadbae7fe5f7c8854 (patch)
tree52a48b364d5f1a107168866c7ffb77f59a235bf6 /tools/qdoc3
parentcdd8e12195fc0bcd1c73853144a26b1b02655e9d (diff)
downloadQt-2b84cad7c8024984de69717fadbae7fe5f7c8854.zip
Qt-2b84cad7c8024984de69717fadbae7fe5f7c8854.tar.gz
Qt-2b84cad7c8024984de69717fadbae7fe5f7c8854.tar.bz2
qdoc3: Allow the full signature for QML signals and methods
...in the \qmlmethod and \qmlsignal commands, and the corresponding "attached" ones. Previously, the type was not allowed, but it really should be there, which means the \qmlmethod and \qmlsignal commands should be updated throughout.
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/cppcodeparser.cpp47
-rw-r--r--tools/qdoc3/cppcodeparser.h10
-rw-r--r--tools/qdoc3/node.cpp7
-rw-r--r--tools/qdoc3/node.h2
4 files changed, 41 insertions, 25 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 90d83ca..ce71e51 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -686,9 +686,9 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
(command == COMMAND_QMLATTACHEDSIGNAL) ||
(command == COMMAND_QMLATTACHEDMETHOD)) {
QString element;
- QString name;
+ QString type;
QmlClassNode* qmlClass = 0;
- if (splitQmlArg(doc,arg,element,name)) {
+ if (splitQmlMethodArg(doc,arg,type,element)) {
Node* n = tre->findNode(QStringList(element),Node::Fake);
if (n && n->subType() == Node::QmlClass) {
qmlClass = static_cast<QmlClassNode*>(n);
@@ -717,15 +717,15 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
<type> <element>::<name>
This function splits the argument into those three
- parts, sets \a type, \a element, and \a property,
+ parts, sets \a type, \a element, and \a name,
and returns true. If any of the parts isn't found,
- a debug message is output and false is returned.
+ a qdoc warning is output and false is returned.
*/
bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
const QString& arg,
QString& type,
QString& element,
- QString& property)
+ QString& name)
{
QStringList blankSplit = arg.split(" ");
if (blankSplit.size() > 1) {
@@ -733,40 +733,47 @@ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
QStringList colonSplit(blankSplit[1].split("::"));
if (colonSplit.size() > 1) {
element = colonSplit[0];
- property = colonSplit[1];
+ name = colonSplit[1];
return true;
}
else
- doc.location().warning(tr("Missing QML element name or property name"));
+ doc.location().warning(tr("Missing parent QML element name"));
}
else
- doc.location().warning(tr("Missing QML property type or property path"));
+ doc.location().warning(tr("Missing property type"));
return false;
}
/*!
A QML signal or method argument has the form...
- <element>::<name>
+ <type> <element>::<name>(<param>, <param>, ...)
This function splits the argument into those two
parts, sets \a element, and \a name, and returns
true. If either of the parts isn't found, a debug
message is output and false is returned.
*/
-bool CppCodeParser::splitQmlArg(const Doc& doc,
- const QString& arg,
- QString& element,
- QString& name)
+bool CppCodeParser::splitQmlMethodArg(const Doc& doc,
+ const QString& arg,
+ QString& type,
+ QString& element)
{
QStringList colonSplit(arg.split("::"));
if (colonSplit.size() > 1) {
- element = colonSplit[0];
- name = colonSplit[1];
+ QStringList blankSplit = colonSplit[0].split(" ");
+ if (blankSplit.size() > 1) {
+ type = blankSplit[0];
+ element = blankSplit[1];
+ }
+ else {
+ type = QString("");
+ element = colonSplit[0];
+ }
return true;
}
else
- doc.location().warning(tr("Missing QML element name or signal/method name"));
+ doc.location().warning(tr("Missing parent QML element or method signature"));
return false;
}
@@ -811,10 +818,10 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
++arg;
while (arg != args.end()) {
if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
- QmlPropertyNode * qmlPropNode = new QmlPropertyNode(qmlPropGroup,
- property,
- type,
- attached);
+ QmlPropertyNode* qmlPropNode = new QmlPropertyNode(qmlPropGroup,
+ property,
+ type,
+ attached);
if (correspondingProperty) {
bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*');
qmlPropNode->setWritable(writableList || correspondingProperty->isWritable());
diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h
index 87c1b69..e2e9d55 100644
--- a/tools/qdoc3/cppcodeparser.h
+++ b/tools/qdoc3/cppcodeparser.h
@@ -99,11 +99,11 @@ class CppCodeParser : public CodeParser
const QString& arg,
QString& type,
QString& element,
- QString& property);
- bool splitQmlArg(const Doc& doc,
- const QString& arg,
- QString& element,
- QString& name);
+ QString& name);
+ bool splitQmlMethodArg(const Doc& doc,
+ const QString& arg,
+ QString& type,
+ QString& element);
#endif
virtual QSet<QString> otherMetaCommands();
virtual void processOtherMetaCommand(const Doc& doc,
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 1217042..373002c 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1094,6 +1094,13 @@ QString FunctionNode::signature(bool values) const
return s;
}
+/*!
+ Print some debugging stuff.
+ */
+void FunctionNode::debug() const
+{
+ qDebug() << "QML METHOD" << name() << "rt" << rt << "pp" << pp;
+}
/*!
\class PropertyNode
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 3f5be6c..dbdc174 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -579,6 +579,8 @@ class FunctionNode : public LeafNode
const QString& element() const { return parent()->name(); }
bool isAttached() const { return att; }
+ void debug() const;
+
private:
void setAssociatedProperty(PropertyNode *property);