mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Add bookmarks support.
The library now contains (simple) methods to handle bookmarks. The bookmark are stored in a separate xml file. Bookmark are mainly a couple (`zimId`, `articleUrl`). However, in the xml we store a bit more data : - The article's title (for display) - The book's title, lang and date (for potential update of zim files)
This commit is contained in:
@ -38,6 +38,7 @@ class LibraryManipulator {
|
||||
public:
|
||||
virtual ~LibraryManipulator() {}
|
||||
virtual bool addBookToLibrary(Book book) = 0;
|
||||
virtual void addBookmarkToLibrary(Bookmark bookmark) = 0;
|
||||
};
|
||||
|
||||
class DefaultLibraryManipulator : public LibraryManipulator {
|
||||
@ -48,6 +49,9 @@ class DefaultLibraryManipulator : public LibraryManipulator {
|
||||
bool addBookToLibrary(Book book) {
|
||||
return library->addBook(book);
|
||||
}
|
||||
void addBookmarkToLibrary(Bookmark bookmark) {
|
||||
library->addBookmark(bookmark);
|
||||
}
|
||||
private:
|
||||
kiwix::Library* library;
|
||||
};
|
||||
@ -113,6 +117,15 @@ class Manager
|
||||
*/
|
||||
bool readOpds(const std::string& content, const std::string& urlHost);
|
||||
|
||||
|
||||
/**
|
||||
* Load a bookmark file.
|
||||
*
|
||||
* @param path The path of the file to read.
|
||||
* @return True if the content has been properly parsed.
|
||||
*/
|
||||
bool readBookmarkFile(const std::string& path);
|
||||
|
||||
/**
|
||||
* Add a book to the library.
|
||||
*
|
||||
|
Reference in New Issue
Block a user