MLBookProc 1.0
 
Loading...
Searching...
No Matches
EPUBParser.h
1/*
2 * Copyright (C) 2024-2025 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
17#ifndef EPUBPARSER_H
18#define EPUBPARSER_H
19
20#include <ArchEntry.h>
21#include <AuxFunc.h>
22#include <BookInfoEntry.h>
23#include <BookParseEntry.h>
24#include <LibArchive.h>
25#include <XMLParser.h>
26#include <XMLTag.h>
27#include <filesystem>
28#include <memory>
29#include <string>
30#include <vector>
31
39class EPUBParser : public XMLParser, public LibArchive
40{
41public:
46 EPUBParser(const std::shared_ptr<AuxFunc> &af);
47
54 epub_parser(const std::filesystem::path &filepath);
55
61 std::shared_ptr<BookInfoEntry>
62 epub_book_info(const std::filesystem::path &filepath);
63
64private:
65 std::string
66 epub_get_root_file_address(const std::filesystem::path &filepath,
67 const std::vector<ArchEntry> &filenames);
68
70 epub_parse_root_file(const std::string &root_file_content);
71
72 std::string
73 epubTitle(const std::string &root_file_content,
74 const std::vector<XMLTag> &tgv);
75
76 std::string
77 epubAuthor(const std::string &root_file_content,
78 const std::vector<XMLTag> &tgv);
79
80 std::string
81 epubGenre(const std::string &root_file_content,
82 const std::vector<XMLTag> &tgv);
83
84 std::string
85 epubDate(const std::string &root_file_content,
86 const std::vector<XMLTag> &tgv);
87
88 std::string
89 epub_annotation(const std::string &root_file_content);
90
91 std::string
92 epub_cover_address(const std::string &root_file_content);
93
94 void
95 epub_language(const std::string &root_file_content, BookInfoEntry &result);
96
97 void
98 epub_translator(const std::string &root_file_content, BookInfoEntry &result);
99
100 void
101 epub_publisher(const std::string &root_file_content, BookInfoEntry &result);
102
103 void
104 epub_identifier(const std::string &root_file_content, BookInfoEntry &result);
105
106 void
107 epub_source(const std::string &root_file_content, BookInfoEntry &result);
108
109 std::shared_ptr<AuxFunc> af;
110};
111
112#endif // EPUBPARSER_H
The BookInfoEntry class.
Definition BookInfoEntry.h:31
The BookParseEntry class.
Definition BookParseEntry.h:30
EPUBParser(const std::shared_ptr< AuxFunc > &af)
EPUBParser constructor.
std::shared_ptr< BookInfoEntry > epub_book_info(const std::filesystem::path &filepath)
Returns epub book info and cover.
BookParseEntry epub_parser(const std::filesystem::path &filepath)
Parses epub book.
LibArchive(const std::shared_ptr< AuxFunc > &af)
LibArchive constructor.
XMLParser(const std::shared_ptr< AuxFunc > &af)
XMLParser constructor.