MLBookProc 2.1
Loading...
Searching...
No Matches
MOBIParser.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 MOBIPARSER_H
17#define MOBIPARSER_H
18
19#include <BaseID.h>
20#include <MLBookProc.h>
21#include <UDBase.h>
22
30{
31public:
37 MOBIParser(const std::shared_ptr<MLBookProc> &mlbp);
38
47 UDBElement
48 parseBook(const std::string &book_content);
49
58 UDBase
59 getBookInfo(const std::string &book_content);
60
61private:
62 std::vector<uint32_t>
63 recordsOffsets(const std::string &book_content);
64
65 std::string
66 getCodePage(const std::string &book_content, const size_t &mobi_offset);
67
68 std::string
69 getBookTitle(const std::string &book_content, const size_t &mobi_offset);
70
71 bool
72 exthExists(const std::string &book_content, const size_t &mobi_offset);
73
74 size_t
75 getMobiHeaderSize(const std::string &book_content,
76 const size_t &mobi_offset);
77
78 size_t
79 getExthHeaderSize(const std::string &book_content,
80 const size_t &exth_offset);
81
82 std::vector<UDBElement>
83 parseExth(const std::string &exth_content,
84 std::shared_ptr<uint32_t> cover_offset
85 = std::shared_ptr<uint32_t>());
86
87 UDBElement
88 getCover(const std::string &book_content, const size_t &mobi_offset,
89 std::shared_ptr<uint32_t> cover_offset,
90 const std::vector<uint32_t> &offsets);
91
92 std::shared_ptr<MLBookProc> mlbp;
93
94 std::string code_page;
95
96 BaseID bid;
97};
98
99#endif // MOBIPARSER_H
The BaseID class.
Definition BaseID.h:28
MOBIParser(const std::shared_ptr< MLBookProc > &mlbp)
MOBIParser constructor.
UDBElement parseBook(const std::string &book_content)
UDBase getBookInfo(const std::string &book_content)