MLBookProc 1.3
Loading...
Searching...
No Matches
BookMarks.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 BOOKMARKS_H
18#define BOOKMARKS_H
19
20#include <AuxFunc.h>
21#include <BookBaseEntry.h>
22#include <memory>
23#include <mutex>
24#include <vector>
25
33{
34public:
39 BookMarks(const std::shared_ptr<AuxFunc> &af);
40
44 virtual ~BookMarks();
45
56 int
57 createBookMark(const std::string &col_name, const BookBaseEntry &bbe);
58
64 std::vector<std::tuple<std::string, BookBaseEntry>>
66
73 void
74 removeBookMark(const std::string &col_name, const BookBaseEntry &bbe);
75
76private:
77 void
78 loadBookMarks();
79
80 std::tuple<std::string, BookBaseEntry>
81 parse_entry(const std::string &buf);
82
83 bool
84 saveBookMarks();
85
86 std::string
87 form_entry(const std::string &col_name, const BookBaseEntry &bbe);
88
89 std::shared_ptr<AuxFunc> af;
90
91 std::filesystem::path bookmp;
92
93 std::vector<std::tuple<std::string, BookBaseEntry>> bookmarks;
94 std::mutex bookmarksmtx;
95};
96
97#endif // BOOKMARKS_H
The BookBaseEntry class.
Definition BookBaseEntry.h:30
std::vector< std::tuple< std::string, BookBaseEntry > > getBookMarks()
Returns bookmarks.
virtual ~BookMarks()
BookMarks destructor.
int createBookMark(const std::string &col_name, const BookBaseEntry &bbe)
Creates bookmark.
BookMarks(const std::shared_ptr< AuxFunc > &af)
BookMarks constructor.
void removeBookMark(const std::string &col_name, const BookBaseEntry &bbe)
Removes bookmark.