Commit graph

7 commits

Author SHA1 Message Date
Berthold Stoeger
ae81b42fe2 core: introduce a few user-defined literals for unit types
Thise makes initialization of unit types more palatable.

For example:

    surface.time = sample.time - duration_t { .seconds = 20 };
=>  surface.time = sample.time - 20_sec;

    delta_depth.mm = feet_to_mm(1.0); // 1ft
=>  delta_depth = 1_ft;

    get_cylinderid_at_time(..., { .seconds = 20 * 60 + 1 }));
=>  get_cylinderid_at_time(..., 20_min + 1_sec));

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-09-11 10:23:07 +02:00
Berthold Stoeger
9bb2255ba8 core: move get_or_create_cylinder() to struct dive
Other cylinder-creation functions were already there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
cc39f709ce core: add constructor/destructor pairs to dive and divecomputer
This allows us to use non-C member variables. Convert a number
of pointers to unique_ptr<>s.

Code in uemis-downloader.cpp had to be refactored, because
it mixed owning and non-owning pointers. Mad.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Anton Lundin
8d3f2e4ca6 Add another test for formatDiveGasString
This adds a test for the bug just fixed, where we have a trimix gas and
nitrox/air with less o2 than the trimix.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
5444a6b65d Remove unnecessary QString
I thought it would solve the unicode issues I had, but it was
unnecessary.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
a681ff3410 Add even more tests for formatDiveGasString
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
bba0da589b Add tests for formatDiveGasString
This adds tests for formatDiveGasString to ensure it produces the
expected results in some scenarios.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00