mirror of https://github.com/kiwix/libkiwix.git
Filter::Tags typedef
This commit is contained in:
parent
3d5fd8f585
commit
19e195cb7d
|
@ -49,10 +49,13 @@ enum supportedListMode {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Filter {
|
class Filter {
|
||||||
private:
|
public: // types
|
||||||
|
using Tags = std::vector<std::string>;
|
||||||
|
|
||||||
|
private: // data
|
||||||
uint64_t activeFilters;
|
uint64_t activeFilters;
|
||||||
std::vector<std::string> _acceptTags;
|
Tags _acceptTags;
|
||||||
std::vector<std::string> _rejectTags;
|
Tags _rejectTags;
|
||||||
std::string _category;
|
std::string _category;
|
||||||
std::string _lang;
|
std::string _lang;
|
||||||
std::string _publisher;
|
std::string _publisher;
|
||||||
|
@ -62,7 +65,7 @@ class Filter {
|
||||||
bool _queryIsPartial;
|
bool _queryIsPartial;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
|
||||||
public:
|
public: // functions
|
||||||
Filter();
|
Filter();
|
||||||
~Filter() = default;
|
~Filter() = default;
|
||||||
|
|
||||||
|
@ -96,8 +99,8 @@ class Filter {
|
||||||
/**
|
/**
|
||||||
* Set the filter to only accept book with corresponding tag.
|
* Set the filter to only accept book with corresponding tag.
|
||||||
*/
|
*/
|
||||||
Filter& acceptTags(std::vector<std::string> tags);
|
Filter& acceptTags(const Tags& tags);
|
||||||
Filter& rejectTags(std::vector<std::string> tags);
|
Filter& rejectTags(const Tags& tags);
|
||||||
|
|
||||||
Filter& category(std::string category);
|
Filter& category(std::string category);
|
||||||
Filter& lang(std::string lang);
|
Filter& lang(std::string lang);
|
||||||
|
@ -126,7 +129,7 @@ class Filter {
|
||||||
bool hasCreator() const;
|
bool hasCreator() const;
|
||||||
const std::string& getCreator() const { return _creator; }
|
const std::string& getCreator() const { return _creator; }
|
||||||
|
|
||||||
private:
|
private: // functions
|
||||||
friend class Library;
|
friend class Library;
|
||||||
|
|
||||||
bool accept(const Book& book) const;
|
bool accept(const Book& book) const;
|
||||||
|
|
|
@ -624,14 +624,14 @@ Filter& Filter::valid(bool accept)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter& Filter::acceptTags(std::vector<std::string> tags)
|
Filter& Filter::acceptTags(const Tags& tags)
|
||||||
{
|
{
|
||||||
_acceptTags = tags;
|
_acceptTags = tags;
|
||||||
activeFilters |= ACCEPTTAGS;
|
activeFilters |= ACCEPTTAGS;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter& Filter::rejectTags(std::vector<std::string> tags)
|
Filter& Filter::rejectTags(const Tags& tags)
|
||||||
{
|
{
|
||||||
_rejectTags = tags;
|
_rejectTags = tags;
|
||||||
activeFilters |= REJECTTAGS;
|
activeFilters |= REJECTTAGS;
|
||||||
|
|
Loading…
Reference in New Issue