MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / getTocEntry

Method getTocEntry

lib/Epub/Epub/BookMetadataCache.cpp:425–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425BookMetadataCache::TocEntry BookMetadataCache::getTocEntry(const int index) {
426 if (!loaded) {
427 LOG_ERR("BMC", "getTocEntry called but cache not loaded");
428 return {};
429 }
430
431 if (index < 0 || index >= static_cast<int>(tocCount)) {
432 LOG_ERR("BMC", "getTocEntry index %d out of range", index);
433 return {};
434 }
435
436 // Seek to TOC LUT item, read from LUT and get out data
437 bookFile.seek(lutOffset + sizeof(uint32_t) * spineCount + sizeof(uint32_t) * index);
438 uint32_t tocEntryPos;
439 serialization::readPod(bookFile, tocEntryPos);
440 bookFile.seek(tocEntryPos);
441 return readTocEntry(bookFile);
442}
443
444BookMetadataCache::SpineEntry BookMetadataCache::readSpineEntry(HalFile& file) const {
445 SpineEntry entry;

Callers 2

getTocItemMethod · 0.80

Calls 2

readPodFunction · 0.85
seekMethod · 0.80

Tested by

no test coverage detected