EHM DAL 0.2.3
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
spreadsheet_file_csv.h
1#pragma once
2
3// Application headers
4#include "include/spreadsheet/private/spreadsheet_file.h"
5
6namespace ehm_dal::spreadsheet {
7
8// --- CSV spreadsheet --- //
10{
11public:
12 // Constructor
14 SpreadsheetFileCsv(QFile &file);
15
16 // Delimiter
17 static QString systemDelimiterDescription();
18
19 // File I/O
20 bool read(std::vector<std::vector<QVariant>> &header,
21 std::vector<std::vector<QVariant>> &cells,
22 const qint32 header_count = 0) override;
23 bool writeCells(std::vector<QVariant> &prefix,
24 std::vector<std::vector<QVariant>> &cells) override;
25 bool writeHeader(std::vector<QVariant> &prefix,
26 std::vector<std::vector<QVariant>> &header) override;
27
28 // Get data
29 bool isAsciiEnabled() const { return !utf_8_enabled_; }
30 bool isUtfEnabled() const { return utf_8_enabled_; }
31
32private:
33 // Delimiter
34 QChar system_delimiter_{systemDelimiter()};
35 static QChar systemDelimiter();
36
37 // File I/O
38 void readRow(std::vector<std::vector<QVariant>> &data, QChar &delimiter);
39 bool write(std::vector<QVariant> &prefix,
40 std::vector<std::vector<QVariant>> &data,
41 const bool silent_progress_dialog = false);
42
43 // Get data
44 QByteArray bom() const;
45
46 // Settings
47 bool utf_8_enabled_{false};
48
49 // Validation
50 void validate(std::vector<QVariant> &cells);
51};
52} // namespace ehm_dal::spreadsheet
Definition: spreadsheet_file_csv.h:10
Definition: spreadsheet_file.h:17