MLBookProc 2.1
Loading...
Searching...
No Matches
FB2Parser.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 FB2PARSER_H
17#define FB2PARSER_H
18
19#include <BaseID.h>
20#include <MLBookProc.h>
21#include <UDBase.h>
22#include <XMLParserCPP.h>
23
31{
32public:
37 FB2Parser(const std::shared_ptr<MLBookProc> &mlbp);
38
39 virtual ~FB2Parser();
40
47 UDBElement
48 parseBook(const std::string &file_content);
49
56 UDBase
57 getBookInfo(const std::string &book_content);
58
59private:
60 UDBElement
61 fb2GetInfoForBase(const std::vector<XMLElement> &book_xml);
62
63 std::vector<UDBElement>
64 fb2Author(const std::vector<XMLElement *> &author);
65
66 void
67 fb2AuthorBookInfo(const std::vector<XMLElement *> &author,
68 std::vector<UDBElement> &result);
69
70 void
71 fb2Series(const std::vector<XMLElement *> &sequence,
72 std::vector<UDBElement> &book_subelements);
73
74 void
75 fb2Annotation(const std::vector<XMLElement *> &annotation,
76 std::string &result);
77
78 void
79 fb2Cover(const std::vector<XMLElement> &book_xml, UDBElement &result);
80
81 void
82 fb2CoverGetImage(const std::vector<XMLElement> &book_xml,
83 const std::vector<XMLElement *> &image, UDBElement &result);
84
85 void
86 getResult(const std::vector<XMLElement *> &elements,
87 std::vector<UDBElement> &result, const BaseID::ID &element_id);
88
89 void
90 normalizeString(std::string &str);
91
92 std::shared_ptr<MLBookProc> mlbp;
93
94 XMLParserCPP *xml_parser;
95
96 BaseID bid;
97};
98
99#endif // FB2PARSER_H
The BaseID class.
Definition BaseID.h:28
ID
The ID enum.
Definition BaseID.h:36
UDBElement parseBook(const std::string &file_content)
FB2Parser(const std::shared_ptr< MLBookProc > &mlbp)
FB2Parser constructor.
UDBase getBookInfo(const std::string &book_content)