diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-14 08:56:53 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-14 15:57:14 -0400 |
commit | 32df0ab0daa8551e24d93082ad182673bbf37cdf (patch) | |
tree | 1abf1003eeafcaf894329089a5582278a6a796d0 /dives | |
parent | cf4d32c6e8bd60b5e825535702f3e2701b40716b (diff) | |
download | subsurface-32df0ab0daa8551e24d93082ad182673bbf37cdf.tar.gz |
Cleanup: remove DiveItem and TripItem classes
The DiveItem and TripItem classes were wrappers around dive * and
dive_trip * used to extract tabular data. With the rework of
DiveTripModel they lost all their state besides the pointer itself.
The usage was:
DiveItem item(d);
item.data(...);
This can now be simplified to the much more idiomatic
diveData(d, ...);
and analoguously for TripItem.
While adapting the data() function to be part of DiveTripModel, change
the
QVariant ret
switch(...) {
...
case ...:
ret = ...;
break;
...
}
return ret;
style to
switch(...) {
...
case ...:
return ...;
}
Not only is this shorter and easier to reason about, it generally also
improves the generated code. The compiler can directly construct the
return value in the buffer provided by the caller. Though modern
compilers start to be very good at avoiding unnecessary copies.
In total this cleanup results in a net-reduction of 190 lines of code.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'dives')
0 files changed, 0 insertions, 0 deletions