Files
crosspoint-reader-mod/src/util/BookmarkStore.h

25 lines
848 B
C
Raw Normal View History

#pragma once
#include <cstdint>
#include <string>
#include <vector>
struct Bookmark {
int16_t spineIndex;
int16_t pageNumber;
std::string snippet; // First sentence or text excerpt from the page
};
class BookmarkStore {
public:
static std::vector<Bookmark> load(const std::string& cachePath);
static bool save(const std::string& cachePath, const std::vector<Bookmark>& bookmarks);
static bool addBookmark(const std::string& cachePath, int spineIndex, int page, const std::string& snippet = "");
static bool removeBookmark(const std::string& cachePath, int spineIndex, int page);
static bool hasBookmark(const std::string& cachePath, int spineIndex, int page);
private:
static std::string filePath(const std::string& cachePath);
static constexpr int MAX_BOOKMARKS = 200;
static constexpr int MAX_SNIPPET_LENGTH = 120;
};