diff options
author | Martin Smith <msmith@trolltech.com> | 2009-10-23 12:39:57 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2009-10-23 12:42:27 (GMT) |
commit | 05aaab72d69a7fa9c23811c1d3ee7d91a9174e46 (patch) | |
tree | 7cdc607a2e7218f05b23bbc70a50b1f3fd1a830b | |
parent | 08cb2ac46791ef3abfd9d85eb6a75251b1f41336 (diff) | |
download | Qt-05aaab72d69a7fa9c23811c1d3ee7d91a9174e46.zip Qt-05aaab72d69a7fa9c23811c1d3ee7d91a9174e46.tar.gz Qt-05aaab72d69a7fa9c23811c1d3ee7d91a9174e46.tar.bz2 |
qdoc3: Added the \qmlattachedsignal and \qmlattachedmethod.
They works just like the \qmlsignal and \qmlmethod commands.
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 38 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 20 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 12 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 16 |
4 files changed, 72 insertions, 14 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 36293f8..a32f92b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1120,10 +1120,18 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, "QML Signals", "signal", "signals"); + FastSection qmlattachedsignals(qmlClassNode, + "QML Attached Signals", + "signal", + "signals"); FastSection qmlmethods(qmlClassNode, "QML Methods", "method", "methods"); + FastSection qmlattachedmethods(qmlClassNode, + "QML Attached Methods", + "method", + "methods"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { @@ -1142,23 +1150,35 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, } } else if ((*c)->type() == Node::QmlSignal) { - insert(qmlsignals,*c,style,Okay); + const QmlSignalNode* sn = static_cast<const QmlSignalNode*>(*c); + if (sn->isAttached()) + insert(qmlattachedsignals,*c,style,Okay); + else + insert(qmlsignals,*c,style,Okay); } else if ((*c)->type() == Node::QmlMethod) { - insert(qmlmethods,*c,style,Okay); + const QmlMethodNode* mn = static_cast<const QmlMethodNode*>(*c); + if (mn->isAttached()) + insert(qmlattachedmethods,*c,style,Okay); + else + insert(qmlmethods,*c,style,Okay); } ++c; } append(sections,qmlproperties); append(sections,qmlattachedproperties); append(sections,qmlsignals); + append(sections,qmlattachedsignals); append(sections,qmlmethods); + append(sections,qmlattachedmethods); } else if (style == Detailed) { FastSection qmlproperties(qmlClassNode,"QML Property Documentation"); FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation"); FastSection qmlsignals(qmlClassNode,"QML Signal Documentation"); + FastSection qmlattachedsignals(qmlClassNode,"QML Attached Signal Documentation"); FastSection qmlmethods(qmlClassNode,"QML Method Documentation"); + FastSection qmlattachedmethods(qmlClassNode,"QML Attached Method Documentation"); NodeList::ConstIterator c = qmlClassNode->childNodes().begin(); while (c != qmlClassNode->childNodes().end()) { if ((*c)->subType() == Node::QmlPropertyGroup) { @@ -1169,17 +1189,27 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, insert(qmlproperties,*c,style,Okay); } else if ((*c)->type() == Node::QmlSignal) { - insert(qmlsignals,*c,style,Okay); + const QmlSignalNode* sn = static_cast<const QmlSignalNode*>(*c); + if (sn->isAttached()) + insert(qmlattachedsignals,*c,style,Okay); + else + insert(qmlsignals,*c,style,Okay); } else if ((*c)->type() == Node::QmlMethod) { - insert(qmlmethods,*c,style,Okay); + const QmlMethodNode* mn = static_cast<const QmlMethodNode*>(*c); + if (mn->isAttached()) + insert(qmlattachedmethods,*c,style,Okay); + else + insert(qmlmethods,*c,style,Okay); } ++c; } append(sections,qmlproperties); append(sections,qmlattachedproperties); append(sections,qmlsignals); + append(sections,qmlattachedsignals); append(sections,qmlmethods); + append(sections,qmlattachedmethods); } } diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index ad43b2b..84ec3f4 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -91,7 +91,9 @@ QT_BEGIN_NAMESPACE #define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty") #define COMMAND_QMLINHERITS Doc::alias("inherits") #define COMMAND_QMLSIGNAL Doc::alias("qmlsignal") +#define COMMAND_QMLATTACHEDSIGNAL Doc::alias("qmlattachedsignal") #define COMMAND_QMLMETHOD Doc::alias("qmlmethod") +#define COMMAND_QMLATTACHEDMETHOD Doc::alias("qmlattachedmethod") #define COMMAND_QMLDEFAULT Doc::alias("default") #endif @@ -485,7 +487,9 @@ QSet<QString> CppCodeParser::topicCommands() << COMMAND_QMLPROPERTY << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL - << COMMAND_QMLMETHOD; + << COMMAND_QMLATTACHEDSIGNAL + << COMMAND_QMLMETHOD + << COMMAND_QMLATTACHEDMETHOD; #else << COMMAND_VARIABLE; #endif @@ -678,7 +682,9 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, return new QmlClassNode(tre->root(), names[0], classNode); } else if ((command == COMMAND_QMLSIGNAL) || - (command == COMMAND_QMLMETHOD)) { + (command == COMMAND_QMLMETHOD) || + (command == COMMAND_QMLATTACHEDSIGNAL) || + (command == COMMAND_QMLATTACHEDMETHOD)) { QString element; QString name; QmlClassNode* qmlClass = 0; @@ -687,9 +693,15 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, if (n && n->subType() == Node::QmlClass) { qmlClass = static_cast<QmlClassNode*>(n); if (command == COMMAND_QMLSIGNAL) - return new QmlSignalNode(qmlClass,name); + return new QmlSignalNode(qmlClass,name,false); + else if (command == COMMAND_QMLATTACHEDSIGNAL) + return new QmlSignalNode(qmlClass,name,true); + else if (command == COMMAND_QMLMETHOD) + return new QmlMethodNode(qmlClass,name,false); + else if (command == COMMAND_QMLATTACHEDMETHOD) + return new QmlMethodNode(qmlClass,name,true); else - return new QmlMethodNode(qmlClass,name); + return 0; // never get here. } } } diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 49f2cc9..61855bc 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1210,8 +1210,10 @@ bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue) /*! Constructor for the QML signal node. */ -QmlSignalNode::QmlSignalNode(QmlClassNode *parent, const QString& name) - : LeafNode(QmlSignal, parent, name) +QmlSignalNode::QmlSignalNode(QmlClassNode *parent, + const QString& name, + bool attached) + : LeafNode(QmlSignal, parent, name), att(attached) { // nothing. } @@ -1219,8 +1221,10 @@ QmlSignalNode::QmlSignalNode(QmlClassNode *parent, const QString& name) /*! Constructor for the QML method node. */ -QmlMethodNode::QmlMethodNode(QmlClassNode *parent, const QString& name) - : LeafNode(QmlMethod, parent, name) +QmlMethodNode::QmlMethodNode(QmlClassNode *parent, + const QString& name, + bool attached) + : LeafNode(QmlMethod, parent, name), att(attached) { // nothing. } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index fed4ea1..20ccb95 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -420,19 +420,31 @@ class QmlPropertyNode : public LeafNode class QmlSignalNode : public LeafNode { public: - QmlSignalNode(QmlClassNode* parent, const QString& name); + QmlSignalNode(QmlClassNode* parent, + const QString& name, + bool attached); virtual ~QmlSignalNode() { } const QString& element() const { return parent()->name(); } + bool isAttached() const { return att; } + + private: + bool att; }; class QmlMethodNode : public LeafNode { public: - QmlMethodNode(QmlClassNode* parent, const QString& name); + QmlMethodNode(QmlClassNode* parent, + const QString& name, + bool attached); virtual ~QmlMethodNode() { } const QString& element() const { return parent()->name(); } + bool isAttached() const { return att; } + + private: + bool att; }; #endif |