mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
Extracted the data generation for services to a helper class.
This commit is contained in:
parent
b0b13de52d
commit
de4540367f
26
YACReaderLibrary/server/yacreader_server_data_helper.cpp
Normal file
26
YACReaderLibrary/server/yacreader_server_data_helper.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "yacreader_server_data_helper.h"
|
||||||
|
|
||||||
|
QString YACReaderServerDataHelper::folderToYSFormat(const qulonglong libraryId, const Folder & folder)
|
||||||
|
{
|
||||||
|
return QString("f\t%1\t%2\t%3\t%4\t%5\r\n")
|
||||||
|
.arg(libraryId)
|
||||||
|
.arg(folder.id)
|
||||||
|
.arg(folder.name)
|
||||||
|
.arg(folder.getNumChildren())
|
||||||
|
.arg(folder.getFirstChildHash());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString YACReaderServerDataHelper::comicToYSFormat(const qulonglong libraryId,const ComicDB & comic)
|
||||||
|
{
|
||||||
|
return QString("c\t%1\t%2\t%3\t%4\t%5\r\n")
|
||||||
|
.arg(libraryId)
|
||||||
|
.arg(comic.id)
|
||||||
|
.arg(comic.getFileName())
|
||||||
|
.arg(comic.getFileSize())
|
||||||
|
.arg(comic.info.hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
YACReaderServerDataHelper::YACReaderServerDataHelper()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
19
YACReaderLibrary/server/yacreader_server_data_helper.h
Normal file
19
YACReaderLibrary/server/yacreader_server_data_helper.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef YACREADERSERVERDATAHELPER_H
|
||||||
|
#define YACREADERSERVERDATAHELPER_H
|
||||||
|
|
||||||
|
#include <QtCore>
|
||||||
|
#include "folder.h"
|
||||||
|
#include "comic_db.h"
|
||||||
|
|
||||||
|
class YACReaderServerDataHelper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static QString folderToYSFormat(const qulonglong libraryId, const Folder & folder);
|
||||||
|
static QString comicToYSFormat(const qulonglong libraryId, const ComicDB & comic);
|
||||||
|
|
||||||
|
private:
|
||||||
|
YACReaderServerDataHelper();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // YACREADERSERVERDATAHELPER_H
|
Loading…
x
Reference in New Issue
Block a user