From 24afc3be038a06d3048603d3b91ee977b018bd16 Mon Sep 17 00:00:00 2001 From: icannotttt <141535655+icannotttt@users.noreply.github.com> Date: Thu, 29 Jan 2026 19:05:39 +0800 Subject: [PATCH] Enhance Xtc class with page and chapter methods Add methods for loading page batches and retrieving chapter information. --- lib/Xtc/Xtc.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/Xtc/Xtc.h b/lib/Xtc/Xtc.h index c8d9a040..558ca597 100644 --- a/lib/Xtc/Xtc.h +++ b/lib/Xtc/Xtc.h @@ -73,6 +73,43 @@ class Xtc { uint16_t getPageHeight() const; uint8_t getBitDepth() const; // 1 = XTC (1-bit), 2 = XTCH (2-bit) + /** + * 动态加载下一批页码 + */ + xtc::XtcError loadNextPageBatch() const { + return parser ? parser->loadNextPageBatch() : xtc::XtcError::FILE_NOT_FOUND; + } + + xtc::XtcError loadPageBatchByStart(uint16_t startPage) const { + return parser ? parser->loadPageBatchByStart(startPage): xtc::XtcError::FILE_NOT_FOUND; + } + + /** + * 获取当前已加载的最大页码 + */ + uint16_t getLoadedMaxPage() const { + return parser ? parser->getLoadedMaxPage() : 0; + } + + /** + * 获取每次加载的批次页数 + */ + uint16_t getPageBatchSize() const { + return parser ? parser->getPageBatchSize() : 10; + } + xtc::XtcError readChapters_gd(uint16_t chapterStart) const { + return parser ? parser->readChapters_gd(chapterStart) : xtc::XtcError::FILE_NOT_FOUND; + } +uint32_t getChapterstartpage(int chapterIndex) { + return parser ? parser->getChapterstartpage(chapterIndex) : 0; +} +std::string getChapterTitleByIndex(int chapterIndex) { + return parser ? parser->getChapterTitleByIndex(chapterIndex) : ""; +} + + + + /** * Load page bitmap data * @param pageIndex Page index (0-based)