summaryrefslogtreecommitdiffstats
path: root/core/divesite.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-04 23:20:29 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commitc22fd9f4fd6699333629b8acb1e9c135a9783082 (patch)
tree7fad8249eb4fb3fa2797329716b1038d115a62d9 /core/divesite.h
parentf2cdca7bccfcdfa04639600689b2b13b38b56898 (diff)
downloadsubsurface-c22fd9f4fd6699333629b8acb1e9c135a9783082.tar.gz
Dive sites: prepare for dive site ref-counting
Add a dive site table to each dive site to keep track of dives that have been added to a dive site. Add two functions to add dives to / remove dives from dive sites. Since dive sites now contain a dive table, the order of includes had to be changed: "divesite.h" now includes "dive.h" and not vice-versa. This caused some include churn. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divesite.h')
-rw-r--r--core/divesite.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/divesite.h b/core/divesite.h
index 09e86bb8c..2210aced1 100644
--- a/core/divesite.h
+++ b/core/divesite.h
@@ -4,6 +4,7 @@
#include "units.h"
#include "taxonomy.h"
+#include "dive.h"
#include <stdlib.h>
#ifdef __cplusplus
@@ -18,6 +19,7 @@ struct dive_site
{
uint32_t uuid;
char *name;
+ struct dive_table dives;
location_t location;
char *description;
char *notes;
@@ -54,6 +56,8 @@ struct dive_site *alloc_dive_site();
int nr_of_dives_at_dive_site(struct dive_site *ds, bool select_only);
bool is_dive_site_used(struct dive_site *ds, bool select_only);
void free_dive_site(struct dive_site *ds);
+void unregister_dive_site(struct dive_site *ds);
+void register_dive_site(struct dive_site *ds);
void delete_dive_site(struct dive_site *ds, struct dive_site_table *ds_table);
struct dive_site *create_dive_site(const char *name, struct dive_site_table *ds_table);
struct dive_site *create_dive_site_with_gps(const char *name, const location_t *, struct dive_site_table *ds_table);
@@ -71,6 +75,8 @@ struct dive_site *find_or_create_dive_site_with_name(const char *name, struct di
void merge_dive_sites(struct dive_site *ref, struct dive_site *dive_sites[], int count);
void purge_empty_dive_sites(struct dive_site_table *ds_table);
void clear_dive_site_table(struct dive_site_table *ds_table);
+void add_dive_to_dive_site(struct dive *d, struct dive_site *ds);
+struct dive_site *unregister_dive_from_dive_site(struct dive *d);
#ifdef __cplusplus
}
@@ -78,6 +84,7 @@ QString constructLocationTags(struct taxonomy_data *taxonomy, bool for_maintab);
/* Make pointer-to-dive_site a "Qt metatype" so that we can pass it through QVariants */
Q_DECLARE_METATYPE(dive_site *);
+Q_DECLARE_METATYPE(dive_site_table_t *);
#endif