MLBookProc 2.1
Loading...
Searching...
No Matches
InpxLoader.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 INPXLOADER_H
17#define INPXLOADER_H
18
19#include <BaseID.h>
20#include <LibArchive.h>
21#include <MLBookProc.h>
22#include <UDBase.h>
23#include <archive_entry.h>
24#include <filesystem>
25
32class InpxLoader : public LibArchive
33{
34public:
39 InpxLoader(const std::shared_ptr<MLBookProc> &mlbp);
40
48 UDBase
49 loadInpxCollection(const std::filesystem::path &books_directory,
50 const std::filesystem::path &inpx_file_path);
51
52private:
53 void
54 parseEntry(std::shared_ptr<archive> a, std::shared_ptr<archive_entry> e,
55 const std::filesystem::path &books_directory);
56
57 std::vector<UDBElement>
58 parseAuthors(const std::string &buf);
59
60 UDBElement
61 parseAuthor(const std::string &buf);
62
63 std::vector<UDBElement>
64 parseGenres(const std::string &buf);
65
66 void
67 parseStructureInfoFile(const std::filesystem::path &inpx_file_path);
68
69 void
70 parseCustomInp(const std::string &buf,
71 const std::filesystem::path &book_directory,
72 const std::filesystem::path &book_file_path
73 = std::filesystem::path());
74
75 UDBElement
76 parseCustomLine(const std::string &line, std::u8string &folder);
77
78 std::vector<std::filesystem::path> books_directory_files;
79
80 UDBase result;
81
82 std::vector<std::string> structure_index;
83
84 BaseID bid;
85};
86
87#endif // INPXLOADER_H
The BaseID class.
Definition BaseID.h:28
InpxLoader(const std::shared_ptr< MLBookProc > &mlbp)
InpxLoader constructor.
UDBase loadInpxCollection(const std::filesystem::path &books_directory, const std::filesystem::path &inpx_file_path)
std::shared_ptr< MLBookProc > mlbp
Definition LibArchive.h:499
LibArchive(const std::shared_ptr< MLBookProc > &mlbp)
LibArchive constructor.