From 207df6fc406e81bfeebdff7f404bd242ff3f099f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 7 May 2024 06:48:35 +0200 Subject: Merging upstream version 0.12.2. Signed-off-by: Daniel Baumann --- src/bookmarks.cc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/bookmarks.cc') diff --git a/src/bookmarks.cc b/src/bookmarks.cc index 89637ad..fd166c4 100644 --- a/src/bookmarks.cc +++ b/src/bookmarks.cc @@ -32,10 +32,16 @@ #include "bookmarks.hh" #include "base/itertools.hh" +#include "bookmarks.json.hh" #include "config.h" std::unordered_set bookmark_metadata::KNOWN_TAGS; +typed_json_path_container logmsg_annotations_handlers = { + yajlpp::pattern_property_handler("(?.*)") + .for_field(&logmsg_annotations::la_pairs), +}; + void bookmark_metadata::add_tag(const std::string& tag) { @@ -58,10 +64,19 @@ bookmark_metadata::remove_tag(const std::string& tag) } bool -bookmark_metadata::empty() const +bookmark_metadata::empty(bookmark_metadata::categories props) const { - return this->bm_name.empty() && this->bm_comment.empty() - && this->bm_tags.empty(); + switch (props) { + case categories::any: + return this->bm_name.empty() && this->bm_comment.empty() + && this->bm_tags.empty() + && this->bm_annotations.la_pairs.empty(); + case categories::partition: + return this->bm_name.empty(); + case categories::notes: + return this->bm_comment.empty() && this->bm_tags.empty() + && this->bm_annotations.la_pairs.empty(); + } } void @@ -69,6 +84,7 @@ bookmark_metadata::clear() { this->bm_comment.clear(); this->bm_tags.clear(); + this->bm_annotations.la_pairs.clear(); } nonstd::optional -- cgit v1.2.3