MLBookProc 1.3
Loading...
Searching...
No Matches
FB2Parser.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 FB2PARSER_H
18#define FB2PARSER_H
19
20#include <AuxFunc.h>
21#include <BookInfoEntry.h>
22#include <BookParseEntry.h>
23#include <XMLParserCPP.h>
24#include <memory>
25#include <string>
26#include <vector>
27
36{
37public:
42 FB2Parser(const std::shared_ptr<AuxFunc> &af);
43
47 virtual ~FB2Parser();
48
59 __attribute__((deprecated)) BookParseEntry
60 fb2_parser(const std::string &book);
61
70 fb2Parser(const std::string &book);
71
81 __attribute__((deprecated)) std::shared_ptr<BookInfoEntry>
82 fb2_book_info(const std::string &book);
83
89 std::shared_ptr<BookInfoEntry>
90 fb2BookInfo(const std::string &book);
91
92private:
94 fb2Description();
95
96 std::string
97 fb2Author(const std::vector<XMLElement *> &author);
98
99 std::string
100 fb2Series(const std::vector<XMLElement *> &sequence);
101
102 std::string
103 fb2Genres(const std::vector<XMLElement *> &genres);
104
105 std::string
106 fb2Date(const std::vector<XMLElement *> &date);
107
108 void
109 fb2AnnotationDecode(std::string &result);
110
112 fb2Cover(std::string &cover);
113
114 void
115 fb2CoverGetImage(const std::vector<XMLElement *> &image, std::string &cover,
117
118 void
119 fb2ExtraInfo(BookInfoEntry &result);
120
121 void
122 fb2Language(const std::vector<XMLElement *> &lang, std::string &result);
123
124 void
125 fb2PublisherInfo(BookInfoEntry &result);
126
127 void
128 fb2PublisherInfoString(const std::vector<XMLElement *> &source,
129 std::string &result);
130
131 void
132 fb2PublisherInfoString(const std::vector<XMLElement> &source,
133 std::string &result);
134
135 void
136 fb2ElectroDocInfo(BookInfoEntry &result);
137
138 std::string
139 getBookEncoding();
140
141 std::string
142 getBookEncoding(const std::string &book);
143
144 void
145 findAnnotationFallback(const std::string &book, BookInfoEntry &result);
146
147 void
148 normalizeString(std::string &str);
149
150 std::shared_ptr<AuxFunc> af;
151
152 XMLParserCPP *xml_parser;
153 std::vector<XMLElement> book_xml;
154 std::vector<XMLElement *> title_info;
155};
156
157#endif // FB2PARSER_H
The BookInfoEntry class.
Definition BookInfoEntry.h:31
cover_types
The cover types enumerator.
Definition BookInfoEntry.h:79
The BookParseEntry class.
Definition BookParseEntry.h:30
FB2Parser(const std::shared_ptr< AuxFunc > &af)
FB2Parser constructor.
std::shared_ptr< BookInfoEntry > fb2_book_info(const std::string &book)
Returns fb2 book info and cover.
std::shared_ptr< BookInfoEntry > fb2BookInfo(const std::string &book)
Returns fb2 book info and cover.
virtual ~FB2Parser()
FB2Parser destructor.
BookParseEntry fb2_parser(const std::string &book)
Parses fb2 book.
BookParseEntry fb2Parser(const std::string &book)
Parses fb2 book.