tools/qdoc3/cppcodemarker.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   192 	break;
   192 	break;
   193     case Node::Class:
   193     case Node::Class:
   194 	synopsis = "class " + name;
   194 	synopsis = "class " + name;
   195 	break;
   195 	break;
   196     case Node::Function:
   196     case Node::Function:
       
   197     case Node::QmlSignal:
       
   198     case Node::QmlMethod:
   197 	func = (const FunctionNode *) node;
   199 	func = (const FunctionNode *) node;
   198 	if (style != SeparateList && !func->returnType().isEmpty())
   200 	if (style != SeparateList && !func->returnType().isEmpty())
   199 	    synopsis = typified(func->returnType()) + " ";
   201 	    synopsis = typified(func->returnType()) + " ";
   200 	synopsis += name;
   202 	synopsis += name;
   201         if (func->metaness() != FunctionNode::MacroWithoutParams) {
   203         if (func->metaness() != FunctionNode::MacroWithoutParams) {
   351 QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
   353 QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
   352 {
   354 {
   353     QString name = taggedQmlNode(node);
   355     QString name = taggedQmlNode(node);
   354     if (summary) {
   356     if (summary) {
   355 	name = linkTag(node,name);
   357 	name = linkTag(node,name);
       
   358     } else if (node->type() == Node::QmlProperty) {
       
   359         const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
       
   360         if (pn->isAttached())
       
   361             name.prepend(pn->element() + QLatin1Char('.'));
   356     }
   362     }
   357     name = "<@name>" + name + "</@name>";
   363     name = "<@name>" + name + "</@name>";
   358     QString synopsis = name;
   364     QString synopsis = name;
   359     if (node->type() == Node::QmlProperty) {
   365     if (node->type() == Node::QmlProperty) {
   360         const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
   366         const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
  1107 {
  1113 {
  1108     QList<Section> sections;
  1114     QList<Section> sections;
  1109     if (qmlClassNode) {
  1115     if (qmlClassNode) {
  1110         if (style == Summary) {
  1116         if (style == Summary) {
  1111 	    FastSection qmlproperties(qmlClassNode,
  1117 	    FastSection qmlproperties(qmlClassNode,
  1112                                       "QML Properties",
  1118                                       "Properties",
  1113                                       "property",
  1119                                       "property",
  1114                                       "properties");
  1120                                       "properties");
  1115 	    FastSection qmlattachedproperties(qmlClassNode,
  1121 	    FastSection qmlattachedproperties(qmlClassNode,
  1116                                               "QML Attached Properties",
  1122                                               "Attached Properties",
  1117                                               "property",
  1123                                               "property",
  1118                                               "properties");
  1124                                               "properties");
  1119 	    FastSection qmlsignals(qmlClassNode,
  1125 	    FastSection qmlsignals(qmlClassNode,
  1120                                 "QML Signals",
  1126                                 "Signals",
  1121                                 "signal",
  1127                                 "signal",
  1122                                 "signals");
  1128                                 "signals");
       
  1129 	    FastSection qmlattachedsignals(qmlClassNode,
       
  1130                                            "QML Attached Signals",
       
  1131                                            "signal",
       
  1132                                            "signals");
  1123 	    FastSection qmlmethods(qmlClassNode,
  1133 	    FastSection qmlmethods(qmlClassNode,
  1124                                    "QML Methods",
  1134                                    "Methods",
  1125                                    "method",
  1135                                    "method",
  1126                                    "methods");
  1136                                    "methods");
       
  1137 	    FastSection qmlattachedmethods(qmlClassNode,
       
  1138                                            "QML Attached Methods",
       
  1139                                            "method",
       
  1140                                            "methods");
  1127 
  1141 
  1128             NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
  1142             NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
  1129             while (c != qmlClassNode->childNodes().end()) {
  1143             while (c != qmlClassNode->childNodes().end()) {
  1130                 if ((*c)->subType() == Node::QmlPropertyGroup) {
  1144                 if ((*c)->subType() == Node::QmlPropertyGroup) {
  1131                     const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c);
  1145                     const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c);
  1140                         }
  1154                         }
  1141                         ++p;
  1155                         ++p;
  1142                     }
  1156                     }
  1143                 }
  1157                 }
  1144                 else if ((*c)->type() == Node::QmlSignal) {
  1158                 else if ((*c)->type() == Node::QmlSignal) {
  1145                     insert(qmlsignals,*c,style,Okay);
  1159                     const FunctionNode* sn = static_cast<const FunctionNode*>(*c);
       
  1160                     if (sn->isAttached())
       
  1161                         insert(qmlattachedsignals,*c,style,Okay);
       
  1162                     else
       
  1163                         insert(qmlsignals,*c,style,Okay);
  1146                 }
  1164                 }
  1147                 else if ((*c)->type() == Node::QmlMethod) {
  1165                 else if ((*c)->type() == Node::QmlMethod) {
  1148                     insert(qmlmethods,*c,style,Okay);
  1166                     const FunctionNode* mn = static_cast<const FunctionNode*>(*c);
       
  1167                     if (mn->isAttached())
       
  1168                         insert(qmlattachedmethods,*c,style,Okay);
       
  1169                     else
       
  1170                         insert(qmlmethods,*c,style,Okay);
  1149                 }
  1171                 }
  1150                 ++c;
  1172                 ++c;
  1151             }
  1173             }
  1152 	    append(sections,qmlproperties);
  1174 	    append(sections,qmlproperties);
  1153 	    append(sections,qmlattachedproperties);
  1175 	    append(sections,qmlattachedproperties);
  1154 	    append(sections,qmlsignals);
  1176 	    append(sections,qmlsignals);
       
  1177 	    append(sections,qmlattachedsignals);
  1155 	    append(sections,qmlmethods);
  1178 	    append(sections,qmlmethods);
       
  1179 	    append(sections,qmlattachedmethods);
  1156         }
  1180         }
  1157         else if (style == Detailed) {
  1181         else if (style == Detailed) {
  1158 	    FastSection qmlproperties(qmlClassNode,"QML Property Documentation");
  1182             FastSection qmlproperties(qmlClassNode, "Property Documentation");
  1159 	    FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation");
  1183 	    FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation");
  1160 	    FastSection qmlsignals(qmlClassNode,"QML Signal Documentation");
  1184             FastSection qmlsignals(qmlClassNode,"Signal Documentation");
  1161 	    FastSection qmlmethods(qmlClassNode,"QML Method Documentation");
  1185 	    FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation");
       
  1186             FastSection qmlmethods(qmlClassNode,"Method Documentation");
       
  1187 	    FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation");
  1162 	    NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
  1188 	    NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
  1163 	    while (c != qmlClassNode->childNodes().end()) {
  1189 	    while (c != qmlClassNode->childNodes().end()) {
  1164                 if ((*c)->subType() == Node::QmlPropertyGroup) {
  1190                 if ((*c)->subType() == Node::QmlPropertyGroup) {
  1165                     const QmlPropGroupNode* pgn = static_cast<const QmlPropGroupNode*>(*c);
  1191                     const QmlPropGroupNode* pgn = static_cast<const QmlPropGroupNode*>(*c);
  1166                     if (pgn->isAttached())
  1192                     if (pgn->isAttached())
  1167                         insert(qmlattachedproperties,*c,style,Okay);
  1193                         insert(qmlattachedproperties,*c,style,Okay);
  1168                     else
  1194                     else
  1169                         insert(qmlproperties,*c,style,Okay);
  1195                         insert(qmlproperties,*c,style,Okay);
  1170 	        }
  1196 	        }
  1171                 else if ((*c)->type() == Node::QmlSignal) {
  1197                 else if ((*c)->type() == Node::QmlSignal) {
  1172                     insert(qmlsignals,*c,style,Okay);
  1198                     const FunctionNode* sn = static_cast<const FunctionNode*>(*c);
       
  1199                     if (sn->isAttached())
       
  1200                         insert(qmlattachedsignals,*c,style,Okay);
       
  1201                     else
       
  1202                         insert(qmlsignals,*c,style,Okay);
  1173                 }
  1203                 }
  1174                 else if ((*c)->type() == Node::QmlMethod) {
  1204                 else if ((*c)->type() == Node::QmlMethod) {
  1175                     insert(qmlmethods,*c,style,Okay);
  1205                     const FunctionNode* mn = static_cast<const FunctionNode*>(*c);
       
  1206                     if (mn->isAttached())
       
  1207                         insert(qmlattachedmethods,*c,style,Okay);
       
  1208                     else
       
  1209                         insert(qmlmethods,*c,style,Okay);
  1176                 }
  1210                 }
  1177 	        ++c;
  1211 	        ++c;
  1178 	    }
  1212 	    }
  1179 	    append(sections,qmlproperties);
  1213 	    append(sections,qmlproperties);
  1180 	    append(sections,qmlattachedproperties);
  1214 	    append(sections,qmlattachedproperties);
  1181 	    append(sections,qmlsignals);
  1215 	    append(sections,qmlsignals);
       
  1216 	    append(sections,qmlattachedsignals);
  1182 	    append(sections,qmlmethods);
  1217 	    append(sections,qmlmethods);
       
  1218 	    append(sections,qmlattachedmethods);
  1183         }
  1219         }
  1184     }
  1220     }
  1185 
  1221 
  1186     return sections;
  1222     return sections;
  1187 }
  1223 }