From d0738891c2fbb8222e555f26025de59f19cf08a6 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 17 Aug 2021 14:22:28 +0200 Subject: [PATCH] Ensure the correct order of files and the TOC. --- src/book.cpp | 2 +- src/book.hpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/book.cpp b/src/book.cpp index a7175d6..6bf90cc 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -58,7 +58,7 @@ book read(const fs::path filepath, const bool raw) { doc.text_raw = zip::read_file(filepath, entry); } - current_book.files.insert({entry, doc}); + current_book.files.emplace_back(entry, doc); } return current_book; diff --git a/src/book.hpp b/src/book.hpp index eafbb1c..70bfbd5 100644 --- a/src/book.hpp +++ b/src/book.hpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include namespace epubgrep::book { @@ -41,9 +43,9 @@ struct document //! EPUB file. struct book { - std::map files; //!< filename, file - std::map toc; //!< title, href - string language; //!< Book language + std::vector> files; //!< filename, file + std::vector> toc; //!< title, href + string language; //!< Book language } __attribute__((aligned(128))); //! Read and process book.