mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn dive-trip location and notes into std::string
Simpler memory management. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2fd226964c
commit
3ee41328f9
29 changed files with 157 additions and 179 deletions
41
core/trip.h
41
core/trip.h
|
|
@ -4,17 +4,22 @@
|
|||
|
||||
#include "divelist.h"
|
||||
|
||||
typedef struct dive_trip
|
||||
#include <string>
|
||||
|
||||
struct dive_trip
|
||||
{
|
||||
char *location;
|
||||
char *notes;
|
||||
struct dive_table dives;
|
||||
std::string location;
|
||||
std::string notes;
|
||||
struct dive_table dives = {};
|
||||
int id; /* unique ID for this trip: used to pass trips through QML. */
|
||||
/* Used by the io-routines to mark trips that have already been written. */
|
||||
bool saved;
|
||||
bool autogen;
|
||||
bool selected;
|
||||
} dive_trip_t;
|
||||
bool saved = false;
|
||||
bool autogen = false;
|
||||
bool selected = false;
|
||||
|
||||
dive_trip();
|
||||
~dive_trip();
|
||||
};
|
||||
|
||||
typedef struct trip_table {
|
||||
int nr, allocated;
|
||||
|
|
@ -23,13 +28,13 @@ typedef struct trip_table {
|
|||
|
||||
static const trip_table_t empty_trip_table = { 0, 0, (struct dive_trip **)0 };
|
||||
|
||||
extern void add_dive_to_trip(struct dive *, dive_trip_t *);
|
||||
extern void add_dive_to_trip(struct dive *, dive_trip *);
|
||||
extern struct dive_trip *unregister_dive_from_trip(struct dive *dive);
|
||||
extern void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table_arg);
|
||||
|
||||
extern void insert_trip(dive_trip_t *trip, struct trip_table *trip_table_arg);
|
||||
extern int remove_trip(const dive_trip_t *trip, struct trip_table *trip_table_arg);
|
||||
extern void free_trip(dive_trip_t *trip);
|
||||
extern void insert_trip(dive_trip *trip, struct trip_table *trip_table_arg);
|
||||
extern int remove_trip(const dive_trip *trip, struct trip_table *trip_table_arg);
|
||||
extern void free_trip(dive_trip *trip);
|
||||
extern timestamp_t trip_date(const struct dive_trip *trip);
|
||||
extern timestamp_t trip_enddate(const struct dive_trip *trip);
|
||||
|
||||
|
|
@ -37,14 +42,14 @@ extern bool trip_less_than(const struct dive_trip *a, const struct dive_trip *b)
|
|||
extern int comp_trips(const struct dive_trip *a, const struct dive_trip *b);
|
||||
extern void sort_trip_table(struct trip_table *table);
|
||||
|
||||
extern dive_trip_t *alloc_trip();
|
||||
extern dive_trip_t *create_trip_from_dive(struct dive *dive);
|
||||
extern dive_trip_t *get_dives_to_autogroup(struct dive_table *table, int start, int *from, int *to, bool *allocated);
|
||||
extern dive_trip_t *get_trip_for_new_dive(struct dive *new_dive, bool *allocated);
|
||||
extern dive_trip_t *get_trip_by_uniq_id(int tripId);
|
||||
extern dive_trip *alloc_trip();
|
||||
extern dive_trip *create_trip_from_dive(struct dive *dive);
|
||||
extern dive_trip *get_dives_to_autogroup(struct dive_table *table, int start, int *from, int *to, bool *allocated);
|
||||
extern dive_trip *get_trip_for_new_dive(struct dive *new_dive, bool *allocated);
|
||||
extern dive_trip *get_trip_by_uniq_id(int tripId);
|
||||
extern bool trips_overlap(const struct dive_trip *t1, const struct dive_trip *t2);
|
||||
|
||||
extern dive_trip_t *combine_trips(struct dive_trip *trip_a, struct dive_trip *trip_b);
|
||||
extern dive_trip *combine_trips(struct dive_trip *trip_a, struct dive_trip *trip_b);
|
||||
extern bool is_trip_before_after(const struct dive *dive, bool before);
|
||||
extern bool trip_is_single_day(const struct dive_trip *trip);
|
||||
extern int trip_shown_dives(const struct dive_trip *trip);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue