From 19e195cb7d0fcfd08ac3a7fe58b04879797e9332 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 13 Apr 2021 11:56:19 +0400 Subject: [PATCH] Filter::Tags typedef --- include/library.h | 17 ++++++++++------- src/library.cpp | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/library.h b/include/library.h index adb47498d..08598b913 100644 --- a/include/library.h +++ b/include/library.h @@ -49,10 +49,13 @@ enum supportedListMode { }; class Filter { - private: + public: // types + using Tags = std::vector; + + private: // data uint64_t activeFilters; - std::vector _acceptTags; - std::vector _rejectTags; + Tags _acceptTags; + Tags _rejectTags; std::string _category; std::string _lang; std::string _publisher; @@ -62,7 +65,7 @@ class Filter { bool _queryIsPartial; std::string _name; - public: + public: // functions Filter(); ~Filter() = default; @@ -96,8 +99,8 @@ class Filter { /** * Set the filter to only accept book with corresponding tag. */ - Filter& acceptTags(std::vector tags); - Filter& rejectTags(std::vector tags); + Filter& acceptTags(const Tags& tags); + Filter& rejectTags(const Tags& tags); Filter& category(std::string category); Filter& lang(std::string lang); @@ -126,7 +129,7 @@ class Filter { bool hasCreator() const; const std::string& getCreator() const { return _creator; } -private: +private: // functions friend class Library; bool accept(const Book& book) const; diff --git a/src/library.cpp b/src/library.cpp index 0f945dc54..b1ad3b27b 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -624,14 +624,14 @@ Filter& Filter::valid(bool accept) return *this; } -Filter& Filter::acceptTags(std::vector tags) +Filter& Filter::acceptTags(const Tags& tags) { _acceptTags = tags; activeFilters |= ACCEPTTAGS; return *this; } -Filter& Filter::rejectTags(std::vector tags) +Filter& Filter::rejectTags(const Tags& tags) { _rejectTags = tags; activeFilters |= REJECTTAGS;