diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-02-11 21:46:02 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-12 11:19:27 -0800 |
commit | 4b15b9dfe910fd0df63bdc8024a919a566c380be (patch) | |
tree | fd9c61a4934c8ce84c8bf0b63e607318669c331d /dive.h | |
parent | e720c82aa1abac491ee48f39a69fe88620115bfc (diff) | |
download | subsurface-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.h | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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 |