diff options
-rw-r--r-- | src/bookmarks.c | 13 | ||||
-rw-r--r-- | src/bookmarks.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/bookmarks.c b/src/bookmarks.c index 0791a207..8bde5b8b 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c | |||
@@ -50,6 +50,19 @@ iBool hasTag_Bookmark(const iBookmark *d, const char *tag) { | |||
50 | return found; | 50 | return found; |
51 | } | 51 | } |
52 | 52 | ||
53 | void addTag_Bookmark(iBookmark *d, const char *tag) { | ||
54 | if (!isEmpty_String(&d->tags)) { | ||
55 | appendChar_String(&d->tags, ' '); | ||
56 | } | ||
57 | appendCStr_String(&d->tags, tag); | ||
58 | } | ||
59 | |||
60 | void removeTag_Bookmark(iBookmark *d, const char *tag) { | ||
61 | const size_t pos = indexOfCStr_String(&d->tags, tag); | ||
62 | remove_Block(&d->tags.chars, pos, strlen(tag)); | ||
63 | trim_String(&d->tags); | ||
64 | } | ||
65 | |||
53 | iDefineTypeConstruction(Bookmark) | 66 | iDefineTypeConstruction(Bookmark) |
54 | 67 | ||
55 | static int cmpTimeDescending_Bookmark_(const iBookmark **a, const iBookmark **b) { | 68 | static int cmpTimeDescending_Bookmark_(const iBookmark **a, const iBookmark **b) { |
diff --git a/src/bookmarks.h b/src/bookmarks.h index 228c7885..9a1ecba3 100644 --- a/src/bookmarks.h +++ b/src/bookmarks.h | |||
@@ -42,6 +42,8 @@ struct Impl_Bookmark { | |||
42 | iLocalDef uint32_t id_Bookmark (const iBookmark *d) { return d->node.key; } | 42 | iLocalDef uint32_t id_Bookmark (const iBookmark *d) { return d->node.key; } |
43 | 43 | ||
44 | iBool hasTag_Bookmark (const iBookmark *d, const char *tag); | 44 | iBool hasTag_Bookmark (const iBookmark *d, const char *tag); |
45 | void addTag_Bookmark (iBookmark *d, const char *tag); | ||
46 | void removeTag_Bookmark (iBookmark *d, const char *tag); | ||
45 | 47 | ||
46 | iDeclareType(Bookmarks) | 48 | iDeclareType(Bookmarks) |
47 | iDeclareTypeConstruction(Bookmarks) | 49 | iDeclareTypeConstruction(Bookmarks) |