-
Notifications
You must be signed in to change notification settings - Fork 0
/
mangamanager.h
36 lines (30 loc) · 943 Bytes
/
mangamanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef MANGAMANAGER_H
#define MANGAMANAGER_H
#include "manga.h"
#include <QString>
#include <QVector>
class MangaManager {
public:
MangaManager(const QString &basePath);
void addManga(const Manga &manga);
Manga getMangaByIndex(int index);
void updateManga(int index, const Manga &manga);
void removeManga(int index);
int getPrimaryIndicesSize() const;
QMap<QString, QList<int>> getSecondaryIndices() const;
private:
QString dataFileName;
QString indexFileName;
QString secondaryIndexFileName;
QVector<qint64> primaryIndices;
QMap<QString, QList<int>> secondaryIndices; // Índice secundário para títulos
QString nextIdFileName;
int nextId; // ID único para mangás
void loadIndices();
void saveIndices();
void loadNextId();
void saveNextId();
void saveAllMangas(const QVector<Manga> &allMangas);
void updateSecondaryIndex();
};
#endif // MANGAMANAGER_H