| 214 | } |
| 215 | |
| 216 | QString StructDef::getDiffString(const StructDef* other) const |
| 217 | { |
| 218 | QString diffs = QString(); |
| 219 | if (m_label != other->m_label) |
| 220 | diffs += QString("\nStruct Label: %1 -> %2").arg(m_label).arg(other->m_label); |
| 221 | if (m_length != other->m_length) |
| 222 | diffs += QString("\nStruct Length: %1 -> %2").arg(m_length).arg(other->m_length); |
| 223 | int i = 0; |
| 224 | while (i < std::max(m_fields.count(), other->m_fields.count())) |
| 225 | { |
| 226 | if (m_fields.count() > i) |
| 227 | { |
| 228 | if (other->m_fields.count() > i) |
| 229 | { |
| 230 | QStringList fieldDiff = m_fields[i]->diffList(other->m_fields[i]); |
| 231 | diffs += fieldDiff.isEmpty() ? |
| 232 | "" : |
| 233 | QString("\n Field %1:\n %2").arg(i).arg(fieldDiff.join("\n ")); |
| 234 | } |
| 235 | else |
| 236 | diffs += QString("\n Field %1:\n ").arg(i) + |
| 237 | m_fields[i]->getFieldDescLines().join(" -> N/A\n ") + " -> N/A"; |
| 238 | } |
| 239 | else |
| 240 | diffs += QString("\n Field %1:\n N/A -> ").arg(i) + |
| 241 | other->m_fields[i]->getFieldDescLines().join("\n N/A -> "); |
| 242 | i++; |
| 243 | } |
| 244 | return diffs; |
| 245 | } |
| 246 | |
| 247 | void StructDef::recalculateOffsets() |
| 248 | { |
no test coverage detected