printing: remove DiveObjectHelperGrantlee

This was a weird helper object, needed for grantlee. Instead
of storing this object, loop over cylinders and dives directly.

The actual accessor function is unchanged and now generates
a DiveObjectHelper or DiveCylinderHelper for every variable
access. Obviously, this is very inefficient. However, this
will be replaced in future commits by direct calls to formatting
functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-12-14 23:21:58 +01:00 committed by Dirk Hohndel
parent bf8261c001
commit d9942269a9
6 changed files with 42 additions and 69 deletions

View file

@ -3,9 +3,9 @@
#define TEMPLATELAYOUT_H
#include "core/statistics.h"
#include "core/equipment.h"
#include <QStringList>
class DiveObjectHelperGrantlee;
class CylinderObjectHelper;
struct print_options;
struct template_options;
@ -36,14 +36,14 @@ public:
private:
struct State {
QList<DiveObjectHelperGrantlee> dives;
QList<const dive *> dives;
QList<stats_t *> years;
QMap<QString, QString> types;
int forloopiterator = -1;
const DiveObjectHelperGrantlee *currentDive = nullptr;
const dive * const *currentDive = nullptr;
const stats_t * const *currentYear = nullptr;
const QString *currentCylinder = nullptr;
const CylinderObjectHelper *currentCylinderObject = nullptr;
const cylinder_t * const *currentCylinderObject = nullptr;
};
const print_options &printOptions;
const template_options &templateOptions;