summaryrefslogtreecommitdiff
path: root/src/bookmarks.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-14 08:29:50 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-14 08:29:50 +0300
commit9981de5692c358411304a03c767408cf6ebeb770 (patch)
treebe6c077b5573d612ed47c3641b9bcf8670397009 /src/bookmarks.h
parent395615d0aff7499e905eb5e768a2a46395bb8dc2 (diff)
Added Bookmarks
Diffstat (limited to 'src/bookmarks.h')
-rw-r--r--src/bookmarks.h39
1 files changed, 39 insertions, 0 deletions
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 @@
1#pragma once
2
3#include <the_Foundation/ptrarray.h>
4#include <the_Foundation/string.h>
5#include <the_Foundation/time.h>
6
7iDeclareType(Bookmark)
8iDeclareTypeConstruction(Bookmark)
9
10struct Impl_Bookmark {
11 iString url;
12 iString title;
13 iString tags;
14 iTime when;
15};
16
17iDeclareType(Bookmarks)
18iDeclareTypeConstruction(Bookmarks)
19
20void clear_Bookmarks (iBookmarks *);
21void load_Bookmarks (iBookmarks *, const char *dirPath);
22void save_Bookmarks (const iBookmarks *, const char *dirPath);
23
24typedef iBool (*iBookmarksFilterFunc) (const iBookmark *);
25typedef int (*iBookmarksCompareFunc)(const iBookmark **, const iBookmark **);
26
27/**
28 * Lists all or a subset of the bookmarks in a sorted array of Bookmark pointers.
29 *
30 * @param filter Filter function to determine which bookmarks should be returned.
31 * If NULL, all bookmarks are listed.
32 * @param cmp Sort function that compares Bookmark pointers. If NULL, the
33 * returned list is sorted by descending creation time.
34 *
35 * @return Collected array of bookmarks. Caller does not get ownership of the
36 * list or the bookmarks.
37 */
38const iPtrArray *list_Bookmarks(const iBookmarks *, iBookmarksFilterFunc filter,
39 iBookmarksCompareFunc cmp);