From 62a2f46d290c67343366cb4f707830fe7d8b3d63 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 13 Feb 2015 13:00:22 +0100 Subject: qdoc: Support documentation of JavaScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update provides the actual support for documenting JavaScript. It has been tested with JavaScript commands in qdoc comments in .qdoc files but not in .js files. Currently, we have the use case of needing to document JavaScript using qdoc comments in .qdoc files. For each qdoc command for QML, i.e. \qmltype, \qmlproperty, etc, there is now a corresponding JavaScript command, i.e. \jstype, \jsproperty, etc. Some of these might not be needed, but they are all provided. Briefly, document JavaScript in a .qdoc file the same way you would document QML in a .qdoc file, but instead of using the \qmlxxx commands, use \jsxxx commands. Change-Id: Ib68a5f66c16472af87d9f776db162332ca13fbb7 Task-number: QTBUG-43715 Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/cppcodemarker.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/tools/qdoc/cppcodemarker.cpp') diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index e609e5920fa..400c4808ed2 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -135,7 +135,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, name = "<@name>" + name + ""; if ((style == Detailed) && !node->parent()->name().isEmpty() && - (node->type() != Node::Property) && !node->isQmlNode()) + (node->type() != Node::Property) && !node->isQmlNode() && !node->isJsNode()) name.prepend(taggedNode(node->parent()) + "::"); switch (node->type()) { @@ -307,14 +307,14 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) QString name = taggedQmlNode(node); if (summary) name = linkTag(node,name); - else if (node->type() == Node::QmlProperty) { + else if (node->isQmlProperty() || node->isJsProperty()) { const QmlPropertyNode* pn = static_cast(node); if (pn->isAttached()) name.prepend(pn->element() + QLatin1Char('.')); } name = "<@name>" + name + ""; QString synopsis; - if (node->type() == Node::QmlProperty) { + if (node->isQmlProperty() || node->isJsProperty()) { const QmlPropertyNode* pn = static_cast(node); synopsis = name + " : " + typified(pn->dataType()); } @@ -1134,10 +1134,10 @@ QList
CppCodeMarker::qmlSections(QmlTypeNode* qmlTypeNode, SynopsisStyl ++c; continue; } - if ((*c)->type() == Node::QmlPropertyGroup) { + if ((*c)->isQmlPropertyGroup() || (*c)->isJsPropertyGroup()) { insert(qmlproperties, *c, style, status); } - else if ((*c)->type() == Node::QmlProperty) { + else if ((*c)->isQmlProperty() || (*c)->isJsProperty()) { const QmlPropertyNode* pn = static_cast(*c); if (pn->isAttached()) insert(qmlattachedproperties,*c,style, status); @@ -1145,17 +1145,17 @@ QList
CppCodeMarker::qmlSections(QmlTypeNode* qmlTypeNode, SynopsisStyl insert(qmlproperties,*c,style, status); } } - else if ((*c)->type() == Node::QmlSignal) { + else if ((*c)->isQmlSignal() || (*c)->isJsSignal()) { const FunctionNode* sn = static_cast(*c); if (sn->isAttached()) insert(qmlattachedsignals,*c,style, status); else insert(qmlsignals,*c,style, status); } - else if ((*c)->type() == Node::QmlSignalHandler) { + else if ((*c)->isQmlSignalHandler() || (*c)->isJsSignalHandler()) { insert(qmlsignalhandlers,*c,style, status); } - else if ((*c)->type() == Node::QmlMethod) { + else if ((*c)->isQmlMethod() || (*c)->isJsMethod()) { const FunctionNode* mn = static_cast(*c); if (mn->isAttached()) insert(qmlattachedmethods,*c,style, status); @@ -1199,27 +1199,27 @@ QList
CppCodeMarker::qmlSections(QmlTypeNode* qmlTypeNode, SynopsisStyl ++c; continue; } - if ((*c)->type() == Node::QmlPropertyGroup) { + if ((*c)->isQmlPropertyGroup() || (*c)->isJsPropertyGroup()) { insert(qmlproperties,*c,style, status); } - else if ((*c)->type() == Node::QmlProperty) { + else if ((*c)->isQmlProperty() || (*c)->isJsProperty()) { const QmlPropertyNode* pn = static_cast(*c); if (pn->isAttached()) insert(qmlattachedproperties,*c,style, status); else insert(qmlproperties,*c,style, status); } - else if ((*c)->type() == Node::QmlSignal) { + else if ((*c)->isQmlSignal() || (*c)->isJsSignal()) { const FunctionNode* sn = static_cast(*c); if (sn->isAttached()) insert(qmlattachedsignals,*c,style, status); else insert(qmlsignals,*c,style, status); } - else if ((*c)->type() == Node::QmlSignalHandler) { + else if ((*c)->isQmlSignalHandler() || (*c)->isJsSignalHandler()) { insert(qmlsignalhandlers,*c,style, status); } - else if ((*c)->type() == Node::QmlMethod) { + else if ((*c)->isQmlMethod() || (*c)->isJsMethod()) { const FunctionNode* mn = static_cast(*c); if (mn->isAttached()) insert(qmlattachedmethods,*c,style, status); @@ -1271,11 +1271,11 @@ QList
CppCodeMarker::qmlSections(QmlTypeNode* qmlTypeNode, SynopsisStyl } NodeList::ConstIterator c = current->childNodes().constBegin(); while (c != current->childNodes().constEnd()) { - if ((*c)->type() == Node::QmlPropertyGroup) { + if ((*c)->isQmlPropertyGroup() || (*c)->isJsPropertyGroup()) { const QmlPropertyGroupNode* qpgn = static_cast(*c); NodeList::ConstIterator p = qpgn->childNodes().constBegin(); while (p != qpgn->childNodes().constEnd()) { - if ((*p)->type() == Node::QmlProperty) { + if ((*p)->isQmlProperty() || (*c)->isJsProperty()) { QString key = (*p)->name(); key = sortName(*p, &key); all.memberMap.insert(key,*p); -- cgit v1.2.3