Slip in a fix for Windows build warnings on mtc-generated code.

This commit is contained in:
Andrzej Kapolka 2014-04-08 15:36:21 -07:00
parent 597d750af9
commit 94a7ded212

View file

@ -143,13 +143,15 @@ void generateOutput (QTextStream& out, const QList<Streamable>& streamables) {
out << " }\n";
out << " index = nextIndex;\n";
}
out << " switch (index) {\n";
for (int i = 0; i < str.fields.size(); i++) {
out << " case " << i << ":\n";
out << " this->" << str.fields.at(i).name << " = value.value<" << str.fields.at(i).type << ">();\n";
out << " break;\n";
if (!str.fields.isEmpty()) {
out << " switch (index) {\n";
for (int i = 0; i < str.fields.size(); i++) {
out << " case " << i << ":\n";
out << " this->" << str.fields.at(i).name << " = value.value<" << str.fields.at(i).type << ">();\n";
out << " break;\n";
}
out << " }\n";
}
out << " }\n";
out << "}\n";
out << "QVariant " << name << "::getField(int index) const {\n";
@ -162,12 +164,14 @@ void generateOutput (QTextStream& out, const QList<Streamable>& streamables) {
out << " }\n";
out << " index = nextIndex;\n";
}
out << " switch (index) {\n";
for (int i = 0; i < str.fields.size(); i++) {
out << " case " << i << ":\n";
out << " return QVariant::fromValue(this->" << str.fields.at(i).name << ");\n";
if (!str.fields.isEmpty()) {
out << " switch (index) {\n";
for (int i = 0; i < str.fields.size(); i++) {
out << " case " << i << ":\n";
out << " return QVariant::fromValue(this->" << str.fields.at(i).name << ");\n";
}
out << " }\n";
}
out << " }\n";
out << " return QVariant();\n";
out << "}\n";