summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-11 21:46:02 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 11:19:27 -0800
commit4b15b9dfe910fd0df63bdc8024a919a566c380be (patch)
treefd9c61a4934c8ce84c8bf0b63e607318669c331d /dive.h
parente720c82aa1abac491ee48f39a69fe88620115bfc (diff)
downloadsubsurface-4b15b9dfe910fd0df63bdc8024a919a566c380be.tar.gz
Save and parse dive site structures to XML
Read and write divesite sections in the XML file. Read divelogs of version 2 and create dive site structures on the fly. Read version 3 files that have divesiteid instead of location / gps. Saves version 3 files where dives no longer have location and gps but instead refer to a divesiteid The commit contains quite a few fprintf(stderr,...) in order to allow better monitoring of the parsing / transforming of locations and gps to dive sites. This will need to be removed later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/dive.h b/dive.h
index 2c9ef3336..c38016bb5 100644
--- a/dive.h
+++ b/dive.h
@@ -8,6 +8,7 @@
#include <zip.h>
#include <sqlite3.h>
#include <string.h>
+#include "divesite.h"
/* Windows has no MIN/MAX macros - so let's just roll our own */
#define MIN(x, y) ({ \
@@ -387,11 +388,6 @@ extern void dive_set_geodata_from_picture(struct dive *d, struct picture *pic);
extern int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc);
-static inline int dive_has_gps_location(struct dive *dive)
-{
- return dive->latitude.udeg || dive->longitude.udeg;
-}
-
static inline void copy_gps_location(struct dive *from, struct dive *to)
{
if (from && to) {
@@ -607,6 +603,16 @@ static inline int get_idx_by_uniq_id(int id)
return i;
}
+static inline bool dive_site_has_gps_location(struct dive_site *ds)
+{
+ return ds && (ds->latitude.udeg || ds->longitude.udeg);
+}
+
+static inline int dive_has_gps_location(struct dive *dive)
+{
+ return dive_site_has_gps_location(get_dive_site_by_uuid(dive->dive_site_uuid));
+}
+
#ifdef __cplusplus
extern "C" {
#endif