#include <tags_filter.hpp>
A TagsFilter is a list of rules (defined using TagMatchers) to check tags against. The first rule that matches sets the result.
Here is an example matching any "highway" tag except "highway=motorway":
bool result = filter(tag);
Use this instead of the old osmium::tags::Filter.
◆ iterator
◆ TagsFilter()
osmium::TagsFilter::TagsFilter |
( |
bool |
default_result = false | ) |
|
|
inlineexplicit |
Constructor.
- Parameters
-
default_result | The result the matching function will return if none of the rules matched. |
◆ add_rule() [1/2]
Add a rule to the filter.
- Parameters
-
result | The result returned when this rule matches. |
matcher | The TagMatcher for checking tags. |
- Returns
- A reference to this filter for chaining.
◆ add_rule() [2/2]
template<typename... TArgs>
TagsFilter& osmium::TagsFilter::add_rule |
( |
bool |
result, |
|
|
TArgs &&... |
args |
|
) |
| |
|
inline |
Add a rule to the filter.
- Parameters
-
result | The result returned when this rule matches. |
args | Arguments to construct a TagMatcher from that is used for checking tags. |
- Returns
- A reference to this filter for chaining.
◆ count()
size_t osmium::TagsFilter::count |
( |
| ) |
const |
|
inlinenoexcept |
Return the number of rules in this filter.
Complexity: Constant.
◆ empty()
bool osmium::TagsFilter::empty |
( |
| ) |
const |
|
inlinenoexcept |
Is this filter empty, ie are there no rules defined?
Complexity: Constant.
◆ operator()()
bool osmium::TagsFilter::operator() |
( |
const osmium::Tag & |
tag | ) |
const |
|
inlinenoexcept |
Matching function. Check the specified tag against the rules.
- Parameters
-
- Returns
- The result of the matching rule, or, if none of the rules matched, the default result.
◆ set_default_result()
void osmium::TagsFilter::set_default_result |
( |
bool |
default_result | ) |
|
|
inlinenoexcept |
Set the default result, the result the matching function will return if none of the rules matched.
◆ m_default_result
bool osmium::TagsFilter::m_default_result |
|
private |
◆ m_rules
std::vector<std::pair<bool, TagMatcher> > osmium::TagsFilter::m_rules |
|
private |
The documentation for this class was generated from the following file: