| 887 | } |
| 888 | |
| 889 | std::string ProgressMapper::generateXPath(const std::shared_ptr<Epub>& epub, int spineIndex, float intra) { |
| 890 | const std::string base = "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body"; |
| 891 | if (intra <= 0.0f) return base; |
| 892 | |
| 893 | size_t spineSize = 0; |
| 894 | const auto href = epub->getSpineItem(spineIndex).href; |
| 895 | if (href.empty() || !epub->getItemSize(href, &spineSize) || spineSize == 0) return base; |
| 896 | |
| 897 | ParagraphStreamer s(static_cast<size_t>(spineSize * std::min(intra, 1.0f))); |
| 898 | if (!streamSpine(epub, spineIndex, s)) return base; |
| 899 | |
| 900 | const int p = s.paragraphCount(); |
| 901 | return (p > 0) ? base + "/p[" + std::to_string(p) + "]" : base; |
| 902 | } |
nothing calls this directly
no test coverage detected