1 #ifndef OSMIUM_TAGS_FILTER_HPP 2 #define OSMIUM_TAGS_FILTER_HPP 39 #include <boost/iterator/filter_iterator.hpp> 44 #include <type_traits> 51 template <
typename TKey>
53 bool operator()(
const TKey& rule_key,
const char* tag_key)
const {
54 return rule_key == tag_key;
60 bool operator()(
const std::string& rule_key,
const char* tag_key)
const {
61 return !std::strcmp(rule_key.c_str(), tag_key);
66 bool operator()(
const std::string& rule_key,
const char* tag_key)
const {
67 return rule_key.compare(0, std::string::npos, tag_key, 0, rule_key.size()) == 0;
71 template <
typename TValue>
73 bool operator()(
const TValue& rule_value,
const char* tag_value)
const {
74 return rule_value == tag_value;
80 bool operator()(
const std::string& rule_value,
const char* tag_value)
const {
81 return !std::strcmp(rule_value.c_str(), tag_value);
87 bool operator()(
const bool ,
const char* )
const noexcept {
93 template <
typename TKey,
typename TValue =
void,
typename TKeyComp = match_key<TKey>,
typename TValueComp = match_value<TValue>>
97 using value_type =
typename std::conditional<std::is_void<TValue>::value, bool, TValue>
::type;
129 using iterator = boost::filter_iterator<filter_type, osmium::TagList::const_iterator>;
131 explicit Filter(
bool default_result =
false) :
135 template <typename V = TValue, typename std::enable_if<!std::is_void<V>::value,
int>
::type = 0>
137 m_rules.emplace_back(result,
false, key, value);
142 m_rules.emplace_back(result,
true, key);
148 if (TKeyComp()(rule.key, tag.
key()) && (rule.ignore_value || TValueComp()(rule.value, tag.
value()))) {
188 #endif // OSMIUM_TAGS_FILTER_HPP
type
Definition: entity_bits.hpp:63
Definition: location.hpp:550
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
const char * key() const noexcept
Definition: tag.hpp:81
const char * value() const
Definition: tag.hpp:85