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

Method getCachedPageCount

lib/Epub/Epub/Section.cpp:353–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353std::optional<uint16_t> Section::getCachedPageCount() const {
354 HalFile f;
355 if (!Storage.openFileForRead("SCT", filePath, f)) {
356 return std::nullopt;
357 }
358
359 const uint32_t fileSize = f.size();
360 if (fileSize < HEADER_SIZE) {
361 return std::nullopt;
362 }
363
364 f.seek(HEADER_SIZE - sizeof(uint32_t) * 4 - sizeof(uint16_t));
365 uint16_t count;
366 serialization::readPod(f, count);
367 return count;
368}
369
370std::optional<uint16_t> Section::getPageForAnchor(const std::string& anchor) const {
371 HalFile f;

Callers 1

toCrossPointMethod · 0.80

Calls 4

readPodFunction · 0.85
openFileForReadMethod · 0.80
seekMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected