This PR makes code more maintainable by leveraging -Wswitch compiler warnings.
Only the RecentRequestsTableModel is not refactored, because its enum ColumnIndex contains additional NUMBER_OF_COLUMNS value.
No behavior change.
This PR makes code more maintainable by leveraging -Wswitch compiler warnings.
Only the RecentRequestsTableModel is not refactored, because its enum ColumnIndex contains additional NUMBER_OF_COLUMNS value.
No behavior change.
Concept ACK.
It’s not clear to me if data() implementation should check for out of bounds. I think Qt views and proxy model behave correctly by querying data inside columnCount() and rowCount().
As follow up:
AddressTableModel::columns member to priv instancesection < columns.size() check in AddressTableModel::headerDataIt’s not clear to me if
data()implementation should check for out of bounds. I think Qt views and proxy model behave correctly by querying data insidecolumnCount()androwCount().
At least, these changes do not affect the current behavior, right?
22.0 milestone?
ACK 1d5d832d5c045cbbe3a0f4aa8fc29e52ecadc182, tested on macOS 11.1 Qt 5.15.2
This refactor brings a safer switch statement design to the address, ban, peer, and transaction table models. It also brings us in accordance with the switch design recommendation included in developer-notes.md.
The ability to leverage the -Wswitch compiler warning, as mentioned in the OP, is another benefit of this refactor. An example of the benefit this brings can be shown by considering a scenario where a new Address type is introduced, and the author forgets to update the code to consider the new type. In such a scenario, the compiler will warn about this, thus preventing errors.