Xteink-X4-crosspoint-reader/lib/Epub/Epub/Section.h

31 lines
692 B
C++

#pragma once
#include "Epub.h"
class Page;
class EpdRenderer;
class Section {
Epub* epub;
const int spineIndex;
EpdRenderer& renderer;
std::string cachePath;
void onPageComplete(const Page* page);
public:
int pageCount = 0;
int currentPage = 0;
explicit Section(Epub* epub, const int spineIndex, EpdRenderer& renderer)
: epub(epub), spineIndex(spineIndex), renderer(renderer) {
cachePath = epub->getCachePath() + "/" + std::to_string(spineIndex);
}
~Section() = default;
void writeCacheMetadata() const;
bool loadCacheMetadata();
void setupCacheDir() const;
void clearCache() const;
bool persistPageDataToSD();
Page* loadPageFromSD() const;
};