core: convert cylinder_t and cylinder_table to C++

This had to be done simultaneously, because the table macros
do not work properly with C++ objects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-28 21:31:11 +02:00 committed by bstoeger
parent 284582d2e8
commit 28520da655
48 changed files with 593 additions and 710 deletions

View file

@ -303,9 +303,9 @@ static int findEnd(const QList<token> &tokenList, int from, int to, token_t star
static std::vector<const cylinder_t *> cylinderList(const dive *d)
{
std::vector<const cylinder_t *> res;
res.reserve(d->cylinders.nr);
for (int i = 0; i < d->cylinders.nr; ++i)
res.push_back(&d->cylinders.cylinders[i]);
res.reserve(d->cylinders.size());
for (auto &cyl: d->cylinders)
res.push_back(&cyl);
return res;
}
@ -481,7 +481,7 @@ QVariant TemplateLayout::getValue(QString list, QString property, const State &s
return QVariant();
const cylinder_t *cylinder = *state.currentCylinderObject;
if (property == "description") {
return cylinder->type.description;
return QString::fromStdString(cylinder->type.description);
} else if (property == "size") {
return get_volume_string(cylinder->type.size, true);
} else if (property == "workingPressure") {