diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-07 04:48:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-07 04:48:35 +0000 |
commit | 207df6fc406e81bfeebdff7f404bd242ff3f099f (patch) | |
tree | a1a796b056909dd0a04ffec163db9363a8757808 /src/bookmarks.hh | |
parent | Releasing progress-linux version 0.11.2-1~progress7.99u1. (diff) | |
download | lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip |
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bookmarks.hh')
-rw-r--r-- | src/bookmarks.hh | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/bookmarks.hh b/src/bookmarks.hh index 189e830..c8ffa56 100644 --- a/src/bookmarks.hh +++ b/src/bookmarks.hh @@ -34,24 +34,56 @@ #include <algorithm> #include <map> -#include <unordered_set> #include <string> +#include <unordered_set> #include <vector> #include "base/lnav_log.hh" +struct logmsg_annotations { + std::map<std::string, std::string> la_pairs; +}; + struct bookmark_metadata { static std::unordered_set<std::string> KNOWN_TAGS; + enum class categories : int { + any = 0, + partition = 0x01, + notes = 0x02, + }; + + bool has(categories props) const + { + if (props == categories::any) { + return true; + } + + if (props == categories::partition && !this->bm_name.empty()) { + return true; + } + + if (props == categories::notes + && (!this->bm_comment.empty() + || !this->bm_annotations.la_pairs.empty() + || !this->bm_tags.empty())) + { + return true; + } + + return false; + } + std::string bm_name; std::string bm_comment; + logmsg_annotations bm_annotations; std::vector<std::string> bm_tags; void add_tag(const std::string& tag); bool remove_tag(const std::string& tag); - bool empty() const; + bool empty(categories props) const; void clear(); }; |