Add comment to moc output to simplify slots flags reading.

Change-Id: I5b8f63b6fa561c108abed4c2726b3aff99144fe2
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jędrzej Nowacki 2013-12-19 10:12:35 +01:00 committed by The Qt Project
parent 74fc422985
commit 6111cc55ca

View File

@ -641,25 +641,38 @@ void Generator::generateFunctions(const QList<FunctionDef>& list, const char *fu
for (int i = 0; i < list.count(); ++i) { for (int i = 0; i < list.count(); ++i) {
const FunctionDef &f = list.at(i); const FunctionDef &f = list.at(i);
QByteArray comment;
unsigned char flags = type; unsigned char flags = type;
if (f.access == FunctionDef::Private) if (f.access == FunctionDef::Private) {
flags |= AccessPrivate; flags |= AccessPrivate;
else if (f.access == FunctionDef::Public) comment.append(QByteArrayLiteral("Private"));
} else if (f.access == FunctionDef::Public) {
flags |= AccessPublic; flags |= AccessPublic;
else if (f.access == FunctionDef::Protected) comment.append(QByteArrayLiteral("Public"));
} else if (f.access == FunctionDef::Protected) {
flags |= AccessProtected; flags |= AccessProtected;
if (f.isCompat) comment.append(QByteArrayLiteral("Protected"));
}
if (f.isCompat) {
flags |= MethodCompatibility; flags |= MethodCompatibility;
if (f.wasCloned) comment.append(QByteArrayLiteral(" | MethodCompatibility"));
}
if (f.wasCloned) {
flags |= MethodCloned; flags |= MethodCloned;
if (f.isScriptable) comment.append(QByteArrayLiteral(" | MethodCloned"));
}
if (f.isScriptable) {
flags |= MethodScriptable; flags |= MethodScriptable;
if (f.revision > 0) comment.append(QByteArrayLiteral(" | isScriptable"));
}
if (f.revision > 0) {
flags |= MethodRevisioned; flags |= MethodRevisioned;
comment.append(QByteArrayLiteral(" | MethodRevisioned"));
}
int argc = f.arguments.count(); int argc = f.arguments.count();
fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x,\n", fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x /* %s */,\n",
stridx(f.name), argc, paramsIndex, stridx(f.tag), flags); stridx(f.name), argc, paramsIndex, stridx(f.tag), flags, comment.constData());
paramsIndex += 1 + argc * 2; paramsIndex += 1 + argc * 2;
} }