Initial commit based on GenericQtClient v0.3.0
This commit is contained in:
28
libs/GenericCore/data/filehandler.h
Normal file
28
libs/GenericCore/data/filehandler.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef FILEHANDLER_H
|
||||
#define FILEHANDLER_H
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
typedef QMap<int, QVariant> ModelItemValues;
|
||||
|
||||
class QJsonDocument;
|
||||
class QString;
|
||||
class QByteArray;
|
||||
|
||||
class FileHandler {
|
||||
public:
|
||||
/// JSON
|
||||
static bool saveToFile(const QJsonDocument& doc, const QString& fileName);
|
||||
static QByteArray loadJSONDataFromFile(const QString fileName);
|
||||
|
||||
/// CSV
|
||||
static QList<ModelItemValues> getItemValuesFromCSVFile(const QString& filePath);
|
||||
static bool exportToCSVFile(const QList<QStringList>& rows, const QString& filePath);
|
||||
|
||||
private:
|
||||
explicit FileHandler();
|
||||
|
||||
static QPair<QString, QByteArray> getFileContent(const QString& filePath);
|
||||
};
|
||||
|
||||
#endif // FILEHANDLER_H
|
||||
Reference in New Issue
Block a user