MLBookProc 1.1
 
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 <DCParser.h>
25#include <LibArchive.h>
26#include <XMLParser.h>
27#include <XMLTag.h>
28#include <filesystem>
29#include <memory>
30#include <string>
31#include <vector>
32
40class EPUBParser : public XMLParser, public LibArchive
41{
42public:
47 EPUBParser(const std::shared_ptr<AuxFunc> &af);
48
52 virtual ~EPUBParser();
53
60 epub_parser(const std::filesystem::path &filepath);
61
67 std::shared_ptr<BookInfoEntry>
68 epub_book_info(const std::filesystem::path &filepath);
69
70private:
71 std::string
72 epub_get_root_file_address(const std::filesystem::path &filepath,
73 const std::vector<ArchEntry> &filenames);
74
76 epub_parse_root_file(const std::string &root_file_content);
77
78 std::string
79 epub_annotation(const std::string &root_file_content);
80
81 std::string
82 epub_cover_address(const std::string &root_file_content);
83
84 void
85 epub_language(const std::string &root_file_content, BookInfoEntry &result);
86
87 void
88 epub_translator(const std::string &root_file_content, BookInfoEntry &result);
89
90 void
91 epub_publisher(const std::string &root_file_content, BookInfoEntry &result);
92
93 void
94 epub_identifier(const std::string &root_file_content, BookInfoEntry &result);
95
96 void
97 epub_source(const std::string &root_file_content, BookInfoEntry &result);
98
99 std::shared_ptr<AuxFunc> af;
100
101 DCParser *dc;
102};
103
104#endif // EPUBPARSER_H
The BookInfoEntry class.
Definition BookInfoEntry.h:31
The BookParseEntry class.
Definition BookParseEntry.h:30
The DCParser class.
Definition DCParser.h:31
EPUBParser(const std::shared_ptr< AuxFunc > &af)
EPUBParser constructor.
virtual ~EPUBParser()
EPUBParser destructor.
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.