diff --git a/manual/genManual.cpp b/manual/genManual.cpp index 96816a811ca90..2bbb69b5e850d 100644 --- a/manual/genManual.cpp +++ b/manual/genManual.cpp @@ -102,8 +102,8 @@ static void parseClass(const QString& name, const QString& in) QRegExp re3("Q_INVOKABLE +([^ ]+) +(\\w+\\([^\\)]*\\))\\s+const\\s*([^\\{]*)\\{"); QRegExp reD("//@ (.*)"); - QRegExp re4 ("class +(\\w+) *: *public +(\\w+) *\\{"); - QRegExp re4b("class +(\\w+) *: *public +(\\w+), *public"); + QRegExp re4 ("class +(\\w+) *(?:final)* *: *public +(\\w+) *\\{"); + QRegExp re4b("class +(\\w+) *(?:final)* *: *public +(\\w+), *public"); Q_ASSERT(re1.isValid() && re2.isValid() && re3.isValid()); @@ -212,6 +212,35 @@ static void scanFile(const QString& in) } } +//--------------------------------------------------------- +// linkClass +// +// Given something like "array[Note]", will return "array[Note]" +//--------------------------------------------------------- +static QRegExp reClasses(""); + +static QString linkClass(const QString& in) + { + if (reClasses.pattern().isEmpty()) { + QStringList classNames; + foreach(const Class& cl, classes) + classNames.append(cl.name); + + reClasses.setPattern("\\b(" + classNames.join('|') + ")\\b"); + Q_ASSERT(reClasses.isValid()); + } + + int pos = reClasses.indexIn(in); + if (pos != -1) { + QString out(in); + out.insert(pos + reClasses.matchedLength(), ""); + out.insert(pos, ""); + + return out; + } + return in; + } + //--------------------------------------------------------- // writeOutput //--------------------------------------------------------- @@ -249,27 +278,11 @@ static void writeOutput() out += "
\n"; foreach(const Proc& p, cl.procs) { out += "
\n"; - - QString type(p.type); - bool found = false; - if (type.endsWith("*")) { - type = type.left(type.size()-1); - foreach(const Class& cl, classes) { - if (cl.name == type) { - found = true; - break; - } - } - } - if (found) - out += QString("%2 ") - .arg(type.toLower()).arg(type); - else - out += QString("%1 ").arg(type); + out += linkClass(p.type) + " "; QRegExp re("([^(]+)\\(([^)]*)\\)"); if (re.indexIn(p.name, 0) != -1) { - out += QString("%2(%3)\n") .arg(re.cap(1)).arg(re.cap(2)); + out += QString("%2(%3)\n") .arg(re.cap(1)).arg(linkClass(re.cap(2))); } else { out += QString("%2\n").arg(p.name); @@ -296,7 +309,7 @@ static void writeOutput() out += QString("%1" "%2" "%3") - .arg(m.name).arg(m.type).arg(m.description); + .arg(m.name).arg(linkClass(m.type)).arg(m.description); out += "\n"; count++; }