mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive list: move sort-functionality into core
To make sorting more controlled, move all sorting functions into the core. For this, introduce a "dive_or_trip" structure, which represents a top-level item. Adapt the DiveTripModel accordingly. There are now three sorting functions: 1) dive_less_than 2) trip_less_than 3) dive_or_trip_less_than These should be used by all sorting code. By moving them to a single place, the mess can hopefully be cleaned up. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ef98a4ff5a
commit
243962a67a
4 changed files with 72 additions and 57 deletions
|
@ -338,6 +338,12 @@ struct dive {
|
|||
unsigned char git_id[20];
|
||||
};
|
||||
|
||||
/* For the top-level list: an entry is either a dive or a trip */
|
||||
struct dive_or_trip {
|
||||
struct dive *dive;
|
||||
struct dive_trip *trip;
|
||||
};
|
||||
|
||||
extern void invalidate_dive_cache(struct dive *dive);
|
||||
extern bool dive_cache_is_valid(const struct dive *dive);
|
||||
|
||||
|
@ -557,6 +563,7 @@ extern int legacy_format_o2pressures(const struct dive *dive, const struct divec
|
|||
|
||||
extern bool dive_less_than(const struct dive *a, const struct dive *b);
|
||||
extern bool trip_less_than(const struct dive_trip *a, const struct dive_trip *b);
|
||||
extern bool dive_or_trip_less_than(struct dive_or_trip a, struct dive_or_trip b);
|
||||
extern void sort_table(struct dive_table *table);
|
||||
extern struct dive *fixup_dive(struct dive *dive);
|
||||
extern void fixup_dc_duration(struct divecomputer *dc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue