cli: Move most classes to shared lib for reuse

This commit is contained in:
2022-03-18 22:33:45 +01:00
parent d43c35819d
commit 478d57b342
33 changed files with 32 additions and 44 deletions

29
shared/filesaver.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef FILESAVER_H
#define FILESAVER_H
#include <QSqlDatabase>
#include <QFileInfo>
#include "pagedata.h"
#include "filedata.h"
#include "sqlitedbservice.h"
class FileSaver
{
private:
SqliteDbService *dbService;
protected:
SaveFileResult addFile(QString path);
SaveFileResult updateFile(QString path);
public:
FileSaver(SqliteDbService &dbService);
SaveFileResult saveFile(const QFileInfo &fileInfo);
int processFiles(const QVector<QString> paths, std::function<SaveFileResult(QString path)> saverFunc,
bool keepGoing, bool verbose);
int addFiles(const QVector<QString> paths, bool keepGoing, bool verbose);
int updateFiles(const QVector<QString> paths, bool keepGoing, bool verbose);
;
};
#endif // FILESAVER_H