Ensure the correct order of files and the TOC.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2021-08-17 14:22:28 +02:00
parent b53e99306c
commit d0738891c2
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 6 additions and 4 deletions

View File

@ -58,7 +58,7 @@ book read(const fs::path filepath, const bool raw)
{ {
doc.text_raw = zip::read_file(filepath, entry); doc.text_raw = zip::read_file(filepath, entry);
} }
current_book.files.insert({entry, doc}); current_book.files.emplace_back(entry, doc);
} }
return current_book; return current_book;

View File

@ -22,6 +22,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <utility>
#include <vector>
namespace epubgrep::book namespace epubgrep::book
{ {
@ -41,9 +43,9 @@ struct document
//! EPUB file. //! EPUB file.
struct book struct book
{ {
std::map<string, document> files; //!< filename, file std::vector<std::pair<string, document>> files; //!< filename, file
std::map<string, string> toc; //!< title, href std::vector<std::pair<string, string>> toc; //!< title, href
string language; //!< Book language string language; //!< Book language
} __attribute__((aligned(128))); } __attribute__((aligned(128)));
//! Read and process book. //! Read and process book.