MLBookProc 1.0.1
 
Loading...
Searching...
No Matches
AddBook.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 ADDBOOK_H
18#define ADDBOOK_H
19
20#include <AuxFunc.h>
21#include <BookMarks.h>
22#include <filesystem>
23#include <memory>
24#include <string>
25#include <tuple>
26#include <vector>
27
34{
35public:
45 AddBook(const std::shared_ptr<AuxFunc> &af,
46 const std::string &collection_name, const bool &remove_sources,
47 const std::shared_ptr<BookMarks> &bookmarks);
48
60 void
61 simple_add(const std::vector<
62 std::tuple<std::filesystem::path, std::filesystem::path>> &books);
63
74 void
75 simple_add_dir(const std::vector<std::tuple<std::filesystem::path,
76 std::filesystem::path>> &books);
77
89 void
91 const std::filesystem::path &archive_path,
92 const std::vector<
93 std::tuple<std::filesystem::path, std::filesystem::path>> &books);
94
105 void
107 const std::filesystem::path &archive_path,
108 const std::vector<
109 std::tuple<std::filesystem::path, std::filesystem::path>> &books);
110
120 void
122 const std::filesystem::path &archive_path,
123 const std::vector<
124 std::tuple<std::filesystem::path, std::filesystem::path>> &books);
125
136 void
138 const std::filesystem::path &archive_path,
139 const std::vector<
140 std::tuple<std::filesystem::path, std::filesystem::path>> &books);
141
149 static std::vector<std::string>
150 archive_filenames(const std::filesystem::path &archive_path,
151 const std::shared_ptr<AuxFunc> &af);
152
153private:
154 void
155 remove_src(const std::vector<
156 std::tuple<std::filesystem::path, std::filesystem::path>> &books);
157
158 std::shared_ptr<AuxFunc> af;
159 std::string collection_name;
160 bool remove_sources = false;
161 std::shared_ptr<BookMarks> bookmarks;
162};
163
164#endif // ADDBOOK_H
static std::vector< std::string > archive_filenames(const std::filesystem::path &archive_path, const std::shared_ptr< AuxFunc > &af)
Lists all files in archive.
void add_to_existing_archive(const std::filesystem::path &archive_path, const std::vector< std::tuple< std::filesystem::path, std::filesystem::path > > &books)
Adds books to existing archive.
void add_to_existing_archive_dir(const std::filesystem::path &archive_path, const std::vector< std::tuple< std::filesystem::path, std::filesystem::path > > &books)
Adds books to existing archive.
AddBook(const std::shared_ptr< AuxFunc > &af, const std::string &collection_name, const bool &remove_sources, const std::shared_ptr< BookMarks > &bookmarks)
AddBook constructor.
void simple_add_dir(const std::vector< std::tuple< std::filesystem::path, std::filesystem::path > > &books)
Adds directories containing book files to collection.
void simple_add(const std::vector< std::tuple< std::filesystem::path, std::filesystem::path > > &books)
Adds single book files.
void overwrite_archive_dir(const std::filesystem::path &archive_path, const std::vector< std::tuple< std::filesystem::path, std::filesystem::path > > &books)
Removes archive from collection and replaces it by new one.
void overwrite_archive(const std::filesystem::path &archive_path, const std::vector< std::tuple< std::filesystem::path, std::filesystem::path > > &books)
Removes archive from collection and replaces it by new one.