From 9981de5692c358411304a03c767408cf6ebeb770 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 14 Aug 2020 08:29:50 +0300 Subject: Added Bookmarks --- src/bookmarks.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/bookmarks.h (limited to 'src/bookmarks.h') diff --git a/src/bookmarks.h b/src/bookmarks.h new file mode 100644 index 00000000..e32f6bef --- /dev/null +++ b/src/bookmarks.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include + +iDeclareType(Bookmark) +iDeclareTypeConstruction(Bookmark) + +struct Impl_Bookmark { + iString url; + iString title; + iString tags; + iTime when; +}; + +iDeclareType(Bookmarks) +iDeclareTypeConstruction(Bookmarks) + +void clear_Bookmarks (iBookmarks *); +void load_Bookmarks (iBookmarks *, const char *dirPath); +void save_Bookmarks (const iBookmarks *, const char *dirPath); + +typedef iBool (*iBookmarksFilterFunc) (const iBookmark *); +typedef int (*iBookmarksCompareFunc)(const iBookmark **, const iBookmark **); + +/** + * Lists all or a subset of the bookmarks in a sorted array of Bookmark pointers. + * + * @param filter Filter function to determine which bookmarks should be returned. + * If NULL, all bookmarks are listed. + * @param cmp Sort function that compares Bookmark pointers. If NULL, the + * returned list is sorted by descending creation time. + * + * @return Collected array of bookmarks. Caller does not get ownership of the + * list or the bookmarks. + */ +const iPtrArray *list_Bookmarks(const iBookmarks *, iBookmarksFilterFunc filter, + iBookmarksCompareFunc cmp); -- cgit v1.2.3