2025-12-23 10:14:13 +01:00
|
|
|
#ifndef FILEHANDLER_H
|
|
|
|
|
#define FILEHANDLER_H
|
|
|
|
|
|
2026-01-04 13:38:54 +01:00
|
|
|
#include <QVariant>
|
|
|
|
|
|
2025-12-23 10:14:13 +01:00
|
|
|
class QJsonDocument;
|
|
|
|
|
class QString;
|
2025-12-23 13:40:33 +01:00
|
|
|
class QByteArray;
|
2025-12-23 10:14:13 +01:00
|
|
|
|
|
|
|
|
class FileHandler {
|
|
|
|
|
public:
|
2026-01-04 13:38:54 +01:00
|
|
|
/// JSON
|
2025-12-23 10:14:13 +01:00
|
|
|
static bool saveToFile(const QJsonDocument& doc, const QString& fileName);
|
2025-12-23 13:40:33 +01:00
|
|
|
static QByteArray loadJSONDataFromFile(const QString fileName);
|
2025-12-23 10:14:13 +01:00
|
|
|
|
2026-01-04 13:38:54 +01:00
|
|
|
/// CSV
|
|
|
|
|
static QList<QHash<int, QVariant>> getItemValuesFromCSVFile(const QString& filePath);
|
|
|
|
|
|
2025-12-23 10:14:13 +01:00
|
|
|
private:
|
|
|
|
|
explicit FileHandler();
|
2026-01-04 13:38:54 +01:00
|
|
|
|
|
|
|
|
static QPair<QString, QByteArray> getFileContent(const QString& filePath);
|
2025-12-23 10:14:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // FILEHANDLER_H
|