summaryrefslogtreecommitdiffstats
path: root/src/bookmarks.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bookmarks.cc22
1 files changed, 19 insertions, 3 deletions
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<std::string> bookmark_metadata::KNOWN_TAGS;
+typed_json_path_container<logmsg_annotations> logmsg_annotations_handlers = {
+ yajlpp::pattern_property_handler("(?<annotation_id>.*)")
+ .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<bookmark_type_t*>