mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: port tag-list to C++
Also adds a new test, which tests merging of two tag-lists. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
640ecb345b
commit
f18acf6fb9
25 changed files with 195 additions and 227 deletions
|
@ -174,7 +174,7 @@ static void free_dive_structures(struct dive *d)
|
|||
free(d->notes);
|
||||
free(d->suit);
|
||||
/* free tags, additional dive computers, and pictures */
|
||||
taglist_free(d->tag_list);
|
||||
d->tags.clear();
|
||||
d->cylinders.clear();
|
||||
d->weightsystems.clear();
|
||||
clear_picture_table(&d->pictures);
|
||||
|
@ -211,7 +211,6 @@ void copy_dive(const struct dive *s, struct dive *d)
|
|||
d->notes = copy_string(s->notes);
|
||||
d->suit = copy_string(s->suit);
|
||||
copy_pictures(&s->pictures, &d->pictures);
|
||||
d->tag_list = taglist_copy(s->tag_list);
|
||||
}
|
||||
|
||||
static void copy_dive_onedc(const struct dive *s, const struct divecomputer &sdc, struct dive *d)
|
||||
|
@ -253,7 +252,7 @@ void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_compo
|
|||
s->dive_site->add_dive(d);
|
||||
}
|
||||
if (what.tags)
|
||||
d->tag_list = taglist_copy(s->tag_list);
|
||||
d->tags = s->tags;
|
||||
if (what.cylinders)
|
||||
copy_cylinder_types(s, d);
|
||||
if (what.weights)
|
||||
|
@ -2349,7 +2348,7 @@ struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset,
|
|||
MERGE_NONZERO(res, a, b, surge);
|
||||
MERGE_NONZERO(res, a, b, chill);
|
||||
copy_pictures(a->pictures.nr ? &a->pictures : &b->pictures, &res->pictures);
|
||||
taglist_merge(&res->tag_list, a->tag_list, b->tag_list);
|
||||
res->tags = taglist_merge(a->tags, b->tags);
|
||||
/* if we get dives without any gas / cylinder information in an import, make sure
|
||||
* that there is at leatst one entry in the cylinder map for that dive */
|
||||
auto cylinders_map_a = std::make_unique<int[]>(std::max(size_t(1), a->cylinders.size()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue