@@ -102,8 +102,8 @@ static void parseClass(const QString& name, const QString& in)
102
102
QRegExp re3 (" Q_INVOKABLE +([^ ]+) +(\\ w+\\ ([^\\ )]*\\ ))\\ s+const\\ s*([^\\ {]*)\\ {" );
103
103
104
104
QRegExp reD (" //@ (.*)" );
105
- QRegExp re4 (" class +(\\ w+) *: *public +(\\ w+) *\\ {" );
106
- QRegExp re4b (" class +(\\ w+) *: *public +(\\ w+), *public" );
105
+ QRegExp re4 (" class +(\\ w+) *(?:final)* * : *public +(\\ w+) *\\ {" );
106
+ QRegExp re4b (" class +(\\ w+) *(?:final)* * : *public +(\\ w+), *public" );
107
107
108
108
Q_ASSERT (re1.isValid () && re2.isValid () && re3.isValid ());
109
109
@@ -212,6 +212,35 @@ static void scanFile(const QString& in)
212
212
}
213
213
}
214
214
215
+ // ---------------------------------------------------------
216
+ // linkClass
217
+ //
218
+ // Given something like "array[Note]", will return "array[<a href="note.html">Note</a>]"
219
+ // ---------------------------------------------------------
220
+ static QRegExp reClasses (" " );
221
+
222
+ static QString linkClass (const QString& in)
223
+ {
224
+ if (reClasses.pattern ().isEmpty ()) {
225
+ QStringList classNames;
226
+ foreach (const Class& cl, classes)
227
+ classNames.append (cl.name );
228
+
229
+ reClasses.setPattern (" \\ b(" + classNames.join (' |' ) + " )\\ b" );
230
+ Q_ASSERT (reClasses.isValid ());
231
+ }
232
+
233
+ int pos = reClasses.indexIn (in);
234
+ if (pos != -1 ) {
235
+ QString out (in);
236
+ out.insert (pos + reClasses.matchedLength (), " </a>" );
237
+ out.insert (pos, " <a href=\" " + in.mid (pos, reClasses.matchedLength ()).toLower () + " .html\" >" );
238
+
239
+ return out;
240
+ }
241
+ return in;
242
+ }
243
+
215
244
// ---------------------------------------------------------
216
245
// writeOutput
217
246
// ---------------------------------------------------------
@@ -249,27 +278,11 @@ static void writeOutput()
249
278
out += " <div class=\" methods\" >\n " ;
250
279
foreach (const Proc& p, cl.procs ) {
251
280
out += " <div class=\" method\" >\n " ;
252
-
253
- QString type (p.type );
254
- bool found = false ;
255
- if (type.endsWith (" *" )) {
256
- type = type.left (type.size ()-1 );
257
- foreach (const Class& cl, classes) {
258
- if (cl.name == type) {
259
- found = true ;
260
- break ;
261
- }
262
- }
263
- }
264
- if (found)
265
- out += QString (" <a href=\" %1.html\" >%2</a> " )
266
- .arg (type.toLower ()).arg (type);
267
- else
268
- out += QString (" %1 " ).arg (type);
281
+ out += linkClass (p.type ) + " " ;
269
282
270
283
QRegExp re (" ([^(]+)\\ (([^)]*)\\ )" );
271
284
if (re.indexIn (p.name , 0 ) != -1 ) {
272
- out += QString (" <b>%2</b>(%3)\n " ) .arg (re.cap (1 )).arg (re.cap (2 ));
285
+ out += QString (" <b>%2</b>(%3)\n " ) .arg (re.cap (1 )).arg (linkClass ( re.cap (2 ) ));
273
286
}
274
287
else {
275
288
out += QString (" <b>%2</b>\n " ).arg (p.name );
@@ -296,7 +309,7 @@ static void writeOutput()
296
309
out += QString (" <td class=\" prop-name\" >%1</td>"
297
310
" <td class=\" prop-type\" >%2</td>"
298
311
" <td class=\" prop-desc\" >%3</td>" )
299
- .arg (m.name ).arg (m.type ).arg (m.description );
312
+ .arg (m.name ).arg (linkClass ( m.type ) ).arg (m.description );
300
313
out += " </tr>\n " ;
301
314
count++;
302
315
}
0 commit comments