From 6111cc55cabc25e4a56e19682bbb481ef5886ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 19 Dec 2013 10:12:35 +0100 Subject: Add comment to moc output to simplify slots flags reading. Change-Id: I5b8f63b6fa561c108abed4c2726b3aff99144fe2 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/tools/moc/generator.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 1af344e908..d831edfef0 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -641,25 +641,38 @@ void Generator::generateFunctions(const QList& list, const char *fu for (int i = 0; i < list.count(); ++i) { const FunctionDef &f = list.at(i); + QByteArray comment; unsigned char flags = type; - if (f.access == FunctionDef::Private) + if (f.access == FunctionDef::Private) { flags |= AccessPrivate; - else if (f.access == FunctionDef::Public) + comment.append(QByteArrayLiteral("Private")); + } else if (f.access == FunctionDef::Public) { flags |= AccessPublic; - else if (f.access == FunctionDef::Protected) + comment.append(QByteArrayLiteral("Public")); + } else if (f.access == FunctionDef::Protected) { flags |= AccessProtected; - if (f.isCompat) + comment.append(QByteArrayLiteral("Protected")); + } + if (f.isCompat) { flags |= MethodCompatibility; - if (f.wasCloned) + comment.append(QByteArrayLiteral(" | MethodCompatibility")); + } + if (f.wasCloned) { flags |= MethodCloned; - if (f.isScriptable) + comment.append(QByteArrayLiteral(" | MethodCloned")); + } + if (f.isScriptable) { flags |= MethodScriptable; - if (f.revision > 0) + comment.append(QByteArrayLiteral(" | isScriptable")); + } + if (f.revision > 0) { flags |= MethodRevisioned; + comment.append(QByteArrayLiteral(" | MethodRevisioned")); + } int argc = f.arguments.count(); - fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x,\n", - stridx(f.name), argc, paramsIndex, stridx(f.tag), flags); + fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x /* %s */,\n", + stridx(f.name), argc, paramsIndex, stridx(f.tag), flags, comment.constData()); paramsIndex += 1 + argc * 2; } -- cgit v1.2.3