diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-14 08:29:50 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-14 08:29:50 +0300 |
commit | 9981de5692c358411304a03c767408cf6ebeb770 (patch) | |
tree | be6c077b5573d612ed47c3641b9bcf8670397009 /src/bookmarks.h | |
parent | 395615d0aff7499e905eb5e768a2a46395bb8dc2 (diff) |
Added Bookmarks
Diffstat (limited to 'src/bookmarks.h')
-rw-r--r-- | src/bookmarks.h | 39 |
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 | |||
7 | iDeclareType(Bookmark) | ||
8 | iDeclareTypeConstruction(Bookmark) | ||
9 | |||
10 | struct Impl_Bookmark { | ||
11 | iString url; | ||
12 | iString title; | ||
13 | iString tags; | ||
14 | iTime when; | ||
15 | }; | ||
16 | |||
17 | iDeclareType(Bookmarks) | ||
18 | iDeclareTypeConstruction(Bookmarks) | ||
19 | |||
20 | void clear_Bookmarks (iBookmarks *); | ||
21 | void load_Bookmarks (iBookmarks *, const char *dirPath); | ||
22 | void save_Bookmarks (const iBookmarks *, const char *dirPath); | ||
23 | |||
24 | typedef iBool (*iBookmarksFilterFunc) (const iBookmark *); | ||
25 | typedef 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 | */ | ||
38 | const iPtrArray *list_Bookmarks(const iBookmarks *, iBookmarksFilterFunc filter, | ||
39 | iBookmarksCompareFunc cmp); | ||