mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: convert taxonomy.c to C++
Since the taxonomy is now a real C++ struct with constructor and destructor, dive_site has to be converted to C++ as well. A bit hairy for now, but will ultimately be distinctly simpler. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3c1401785b
commit
3f8b4604be
39 changed files with 259 additions and 336 deletions
|
@ -19,11 +19,14 @@
|
|||
#include "device.h"
|
||||
#include "gettext.h"
|
||||
|
||||
parser_state::parser_state()
|
||||
{
|
||||
}
|
||||
|
||||
parser_state::~parser_state()
|
||||
{
|
||||
free_dive(cur_dive);
|
||||
free_trip(cur_trip);
|
||||
free_dive_site(cur_dive_site);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -188,7 +191,7 @@ void dive_site_start(struct parser_state *state)
|
|||
return;
|
||||
state->taxonomy_category = -1;
|
||||
state->taxonomy_origin = -1;
|
||||
state->cur_dive_site = (dive_site *)calloc(1, sizeof(struct dive_site));
|
||||
state->cur_dive_site = std::make_unique<dive_site>();
|
||||
}
|
||||
|
||||
void dive_site_end(struct parser_state *state)
|
||||
|
@ -197,13 +200,12 @@ void dive_site_end(struct parser_state *state)
|
|||
return;
|
||||
|
||||
struct dive_site *ds = alloc_or_get_dive_site(state->cur_dive_site->uuid, state->log->sites);
|
||||
merge_dive_site(ds, state->cur_dive_site);
|
||||
merge_dive_site(ds, state->cur_dive_site.get());
|
||||
|
||||
if (verbose > 3)
|
||||
printf("completed dive site uuid %x8 name {%s}\n", ds->uuid, ds->name);
|
||||
|
||||
free_dive_site(state->cur_dive_site);
|
||||
state->cur_dive_site = NULL;
|
||||
state->cur_dive_site.reset();
|
||||
}
|
||||
|
||||
void filter_preset_start(struct parser_state *state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue