summaryrefslogtreecommitdiff
path: root/tools/qdoc3/cppcodemarker.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 17:09:54 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 17:43:30 +1000
commit0eaa3466077839b0cef2ad6c326d80f398eccae7 (patch)
tree4c6855559ec940e2ac87514d14a0573593247915 /tools/qdoc3/cppcodemarker.cpp
parenta45fe18569be1fc91e26f6e58d2f16bc8c6958de (diff)
downloadqt4-tools-0eaa3466077839b0cef2ad6c326d80f398eccae7.tar.gz
Merge QML specific qdoc changes
Reviewed-by: Martin Smith
Diffstat (limited to 'tools/qdoc3/cppcodemarker.cpp')
-rw-r--r--tools/qdoc3/cppcodemarker.cpp141
1 files changed, 131 insertions, 10 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index f807609eb1..0f8d1b7d31 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -284,7 +284,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
}
else {
for (int i = 0; i < documentedItems.size(); ++i) {
- if (i < MaxEnumValues - 2 || i == documentedItems.size() - 1) {
+ if (i < MaxEnumValues-2 || i == documentedItems.size()-1) {
if (i != 0)
synopsis += ", ";
synopsis += documentedItems.at(i);
@@ -345,6 +345,43 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
return synopsis + extra;
}
+#ifdef QDOC_QML
+/*!
+ */
+QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
+{
+ QString name = taggedQmlNode(node);
+ if (summary) {
+ name = linkTag(node,name);
+ }
+ name = "<@name>" + name + "</@name>";
+ QString synopsis = name;
+ if (node->type() == Node::QmlProperty) {
+ const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
+ synopsis += " : " + typified(pn->dataType());
+ }
+
+ QString extra;
+ if (summary) {
+ if (node->status() == Node::Preliminary) {
+ extra += " (preliminary)";
+ }
+ else if (node->status() == Node::Deprecated) {
+ extra += " (deprecated)";
+ }
+ else if (node->status() == Node::Obsolete) {
+ extra += " (obsolete)";
+ }
+ }
+
+ if (!extra.isEmpty()) {
+ extra.prepend("<@extra>");
+ extra.append("</@extra>");
+ }
+ return synopsis + extra;
+}
+#endif
+
QString CppCodeMarker::markedUpName(const Node *node)
{
QString name = linkTag(node, taggedNode(node));
@@ -537,7 +574,7 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
else if (isStatic) {
if ((*c)->type() != Node::Variable
|| !(*c)->doc().isEmpty())
- insert(staticPublicMembers, *c, style, status);
+ insert(staticPublicMembers,*c,style,status);
}
else if ((*c)->type() == Node::Property) {
insert(properties, *c, style, status);
@@ -561,11 +598,11 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
else if (isStatic) {
if ((*c)->type() != Node::Variable
|| !(*c)->doc().isEmpty())
- insert(staticProtectedMembers, *c, style, status);
+ insert(staticProtectedMembers,*c,style,status);
}
else if ((*c)->type() == Node::Variable) {
if (!(*c)->doc().isEmpty())
- insert(protectedVariables, *c, style, status);
+ insert(protectedVariables,*c,style,status);
}
else if ((*c)->type() == Node::Function) {
if (!insertReimpFunc(protectedFunctions,*c,status))
@@ -582,14 +619,14 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
else if (isStatic) {
if ((*c)->type() != Node::Variable
|| !(*c)->doc().isEmpty())
- insert(staticPrivateMembers, *c, style, status);
+ insert(staticPrivateMembers,*c,style,status);
}
else if ((*c)->type() == Node::Function) {
if (!insertReimpFunc(privateFunctions,*c,status))
insert(privateFunctions, *c, style, status);
}
else {
- insert(privateTypes, *c, style, status);
+ insert(privateTypes,*c,style,status);
}
}
++c;
@@ -706,17 +743,23 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
"Namespaces",
"namespace",
"namespaces");
- FastSection classes(inner, "Classes", "class", "classes");
+ FastSection classes(inner,
+ "Classes",
+ "class",
+ "classes");
FastSection types(inner,
- style == Summary ? "Types" : "Type Documentation",
+ style == Summary ?
+ "Types" : "Type Documentation",
"type",
"types");
FastSection functions(inner,
- style == Summary ? "Functions" : "Function Documentation",
+ style == Summary ?
+ "Functions" : "Function Documentation",
"function",
"functions");
FastSection macros(inner,
- style == Summary ? "Macros" : "Macro Documentation",
+ style == Summary ?
+ "Macros" : "Macro Documentation",
"macro",
"macros");
@@ -1051,4 +1094,82 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode,
return result;
}
+#ifdef QDOC_QML
+/*!
+ This function is for documenting QML properties. It returns
+ the list of documentation sections for the children of the
+ \a qmlClassNode.
+
+ Currently, it only handles QML property groups.
+ */
+QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
+ SynopsisStyle style)
+{
+ QList<Section> sections;
+ if (qmlClassNode) {
+ if (style == Summary) {
+ FastSection qmlproperties(qmlClassNode,
+ "QML Properties",
+ "property",
+ "properties");
+ FastSection qmlsignals(qmlClassNode,
+ "QML Signals",
+ "signal",
+ "signals");
+ FastSection qmlmethods(qmlClassNode,
+ "QML Methods",
+ "method",
+ "methods");
+
+ NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
+ while (c != qmlClassNode->childNodes().end()) {
+ if ((*c)->subType() == Node::QmlPropertyGroup) {
+ const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c);
+ NodeList::ConstIterator p = qpgn->childNodes().begin();
+ while (p != qpgn->childNodes().end()) {
+ if ((*p)->type() == Node::QmlProperty) {
+ insert(qmlproperties,*p,style,Okay);
+ }
+ ++p;
+ }
+ }
+ else if ((*c)->type() == Node::QmlSignal) {
+ insert(qmlsignals,*c,style,Okay);
+ }
+ else if ((*c)->type() == Node::QmlMethod) {
+ insert(qmlmethods,*c,style,Okay);
+ }
+ ++c;
+ }
+ append(sections,qmlproperties);
+ append(sections,qmlsignals);
+ append(sections,qmlmethods);
+ }
+ else if (style == Detailed) {
+ FastSection qmlproperties(qmlClassNode,"QML Property Documentation");
+ FastSection qmlsignals(qmlClassNode,"QML Signal Documentation");
+ FastSection qmlmethods(qmlClassNode,"QML Method Documentation");
+ NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
+ while (c != qmlClassNode->childNodes().end()) {
+ if ((*c)->subType() == Node::QmlPropertyGroup) {
+ insert(qmlproperties,*c,style,Okay);
+ }
+ else if ((*c)->type() == Node::QmlSignal) {
+ insert(qmlsignals,*c,style,Okay);
+ }
+ else if ((*c)->type() == Node::QmlMethod) {
+ insert(qmlmethods,*c,style,Okay);
+ }
+ ++c;
+ }
+ append(sections,qmlproperties);
+ append(sections,qmlsignals);
+ append(sections,qmlmethods);
+ }
+ }
+
+ return sections;
+}
+#endif
+
QT_END_NAMESPACE