2018-01-06 20:24:38 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef IMPORTCSV_H
|
|
|
|
#define IMPORTCSV_H
|
|
|
|
|
2020-06-17 20:45:33 +00:00
|
|
|
#include "filterpreset.h"
|
|
|
|
|
2020-10-17 18:15:23 +00:00
|
|
|
struct xml_params;
|
|
|
|
|
2018-01-06 20:24:38 +00:00
|
|
|
enum csv_format {
|
|
|
|
CSV_DEPTH,
|
|
|
|
CSV_TEMP,
|
|
|
|
CSV_PRESSURE,
|
|
|
|
POSEIDON_DEPTH,
|
|
|
|
POSEIDON_TEMP,
|
|
|
|
POSEIDON_SETPOINT,
|
|
|
|
POSEIDON_SENSOR1,
|
|
|
|
POSEIDON_SENSOR2,
|
|
|
|
POSEIDON_NDL,
|
|
|
|
POSEIDON_CEILING
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAXCOLDIGITS 10
|
|
|
|
|
2018-09-28 10:09:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
core: introduce divelog structure
The parser API was very annoying, as a number of tables
to-be-filled were passed in as pointers. The goal of this
commit is to collect all these tables in a single struct.
This should make it (more or less) clear what is actually
written into the divelog files.
Moreover, it should now be rather easy to search for
instances, where the global logfile is accessed (and it
turns out that there are many!).
The divelog struct does not contain the tables as substructs,
but only collects pointers. The idea is that the "divelog.h"
file can be included without all the other files describing
the numerous tables.
To make it easier to use from C++ parts of the code, the
struct implements a constructor and a destructor. Sadly,
we can't use smart pointers, since the pointers are accessed
from C code. Therfore the constructor and destructor are
quite complex.
The whole commit is large, but was mostly an automatic
conversion.
One oddity of note: the divelog structure also contains
the "autogroup" flag, since that is saved in the divelog.
This actually fixes a bug: Before, when importing dives
from a different log, the autogroup flag was overwritten.
This was probably not intended and does not happen anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-08 20:31:08 +00:00
|
|
|
int parse_csv_file(const char *filename, struct xml_params *params, const char *csvtemplate, struct divelog *log);
|
|
|
|
int try_to_open_csv(struct memblock *mem, enum csv_format type, struct divelog *log);
|
|
|
|
int parse_txt_file(const char *filename, const char *csv, struct divelog *log);
|
|
|
|
|
|
|
|
int parse_seabear_log(const char *filename, struct divelog *log);
|
|
|
|
int parse_manual_file(const char *filename, struct xml_params *params, struct divelog *log);
|
2018-01-06 20:24:38 +00:00
|
|
|
|
2018-09-28 10:09:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-01-06 20:24:38 +00:00
|
|
|
#endif // IMPORTCSV_H
|