MLBookProc 2.1
Loading...
Searching...
No Matches
EPUBParser.h
1/*
2 * Copyright (C) 2026 Yury Bobylev <bobilev_yury@mail.ru>
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation, version 3.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#ifndef EPUBPARSER_H
17#define EPUBPARSER_H
18
19#include <BaseID.h>
20#include <DublinCoreParser.h>
21#include <LibArchive.h>
22#include <MLBookProc.h>
23#include <UDBase.h>
24
32{
33public:
38 EPUBParser(const std::shared_ptr<MLBookProc> &mlbp);
39
40 virtual ~EPUBParser();
41
48 UDBElement
49 parseBook(const std::string &book_content);
50
57 UDBase
58 getBookInfo(const std::string &book_content);
59
60private:
61 std::string
62 epubGetRootFileAddress(
63 const std::string &book_content,
64 const std::vector<std::tuple<std::string, uint64_t, uint64_t>>
65 &filenames);
66
67 void
68 epubParseRootFile(const std::string &root_file_content, UDBElement &result);
69
70 std::string
71 epubCoverAddress1(const std::vector<XMLElement> &root_file_content);
72
73 std::string
74 epubCoverAddress2(
75 const std::vector<XMLElement> &root_file_content,
76 const std::string &root_file_path, const std::string &book_content,
77 const std::vector<std::tuple<std::string, uint64_t, uint64_t>>
78 &filenames);
79
80 bool
81 imageSearchFunction1(const XMLElement &el);
82
83 bool
84 imageSearchFunction2(const XMLElement &el);
85
86 void
87 normalizeString(std::string &str);
88
89 std::shared_ptr<MLBookProc> mlbp;
90
91 DublinCoreParser *dc_parser;
92 XMLParserCPP *xml_parser;
93 LibArchive *arch;
94
95 BaseID bid;
96};
97
98#endif // EPUBPARSER_H
The BaseID class.
Definition BaseID.h:28
The DublinCoreParser class.
Definition DublinCoreParser.h:33
EPUBParser(const std::shared_ptr< MLBookProc > &mlbp)
EPUBParser constructor.
UDBase getBookInfo(const std::string &book_content)
UDBElement parseBook(const std::string &book_content)
The LibArchive class.
Definition LibArchive.h:34