core: convert weightsystem_t and weightsystem_table to C++

As for cylinders, this had to be done simultaneously,

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-29 07:03:03 +02:00 committed by bstoeger
parent 28520da655
commit 640ecb345b
28 changed files with 137 additions and 247 deletions

View file

@ -96,24 +96,18 @@ static void put_HTML_bookmarks(struct membuffer *b, const struct dive *dive)
static void put_weightsystem_HTML(struct membuffer *b, const struct dive *dive)
{
int i, nr;
nr = nr_weightsystems(dive);
put_string(b, "\"Weights\":[");
const char *separator = "";
for (i = 0; i < nr; i++) {
weightsystem_t ws = dive->weightsystems.weightsystems[i];
for (auto &ws: dive->weightsystems) {
int grams = ws.weight.grams;
const char *description = ws.description;
put_string(b, separator);
separator = ", ";
put_string(b, "{");
put_HTML_weight_units(b, grams, "\"weight\":\"", "\",");
write_attribute(b, "description", description, " ");
write_attribute(b, "description", ws.description.c_str(), " ");
put_string(b, "}");
}
put_string(b, "],");