Skip to content

Commit 4460a91

Browse files
committed
Refactoring: Remove unused parameter from filter_tags()/check_key()
After the multi code is gone, the 'strict' parameter is always false.
1 parent feb2e0d commit 4460a91

File tree

5 files changed

+36
-43
lines changed

5 files changed

+36
-43
lines changed

src/tagtransform-c.cpp

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ std::unique_ptr<tagtransform_t> c_tagtransform_t::clone() const
101101
}
102102

103103
bool c_tagtransform_t::check_key(std::vector<taginfo> const &infos,
104-
char const *k, bool *filter, int *flags,
105-
bool strict)
104+
char const *k, bool *filter, int *flags)
106105
{
107106
//go through the actual tags found on the item and keep the ones in the export list
108107
for (auto const &info : infos) {
@@ -119,29 +118,26 @@ bool c_tagtransform_t::check_key(std::vector<taginfo> const &infos,
119118
}
120119

121120
// if we didn't find any tags that we wanted to export
122-
// and we aren't strictly adhering to the list
123-
if (!strict) {
124-
if (m_options->hstore_mode != hstore_column::none) {
125-
/* ... but if hstore_match_only is set then don't take this
121+
if (m_options->hstore_mode != hstore_column::none) {
122+
/* ... but if hstore_match_only is set then don't take this
126123
as a reason for keeping the object */
127-
if (!m_options->hstore_match_only) {
128-
*filter = false;
129-
}
130-
/* with hstore, copy all tags... */
131-
return true;
124+
if (!m_options->hstore_match_only) {
125+
*filter = false;
132126
}
127+
/* with hstore, copy all tags... */
128+
return true;
129+
}
133130

134-
if (!m_options->hstore_columns.empty()) {
135-
/* does this column match any of the hstore column prefixes? */
136-
for (auto const &column : m_options->hstore_columns) {
137-
if (boost::starts_with(k, column)) {
138-
/* ... but if hstore_match_only is set then don't take this
131+
if (!m_options->hstore_columns.empty()) {
132+
/* does this column match any of the hstore column prefixes? */
133+
for (auto const &column : m_options->hstore_columns) {
134+
if (boost::starts_with(k, column)) {
135+
/* ... but if hstore_match_only is set then don't take this
139136
as a reason for keeping the object */
140-
if (!m_options->hstore_match_only) {
141-
*filter = false;
142-
}
143-
return true;
137+
if (!m_options->hstore_match_only) {
138+
*filter = false;
144139
}
140+
return true;
145141
}
146142
}
147143
}
@@ -150,7 +146,7 @@ bool c_tagtransform_t::check_key(std::vector<taginfo> const &infos,
150146
}
151147

152148
bool c_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
153-
int *roads, taglist_t &out_tags, bool strict)
149+
int *roads, taglist_t &out_tags)
154150
{
155151
//assume we dont like this set of tags
156152
bool filter = true;
@@ -170,27 +166,25 @@ bool c_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
170166
for (auto const &item : o.tags()) {
171167
char const *const k = item.key();
172168
char const *const v = item.value();
173-
//if we want to do more than the export list says
174-
if (!strict) {
175-
if (o.type() == osmium::item_type::relation &&
176-
std::strcmp("type", k) == 0) {
177-
out_tags.add_tag(k, v);
169+
170+
if (o.type() == osmium::item_type::relation &&
171+
std::strcmp("type", k) == 0) {
172+
out_tags.add_tag(k, v);
173+
continue;
174+
}
175+
/* Allow named islands to appear as polygons */
176+
if (std::strcmp("natural", k) == 0 &&
177+
std::strcmp("coastline", v) == 0) {
178+
add_area_tag = 1;
179+
180+
/* Discard natural=coastline tags (we render these from a shapefile instead) */
181+
if (!m_options->keep_coastlines) {
178182
continue;
179183
}
180-
/* Allow named islands to appear as polygons */
181-
if (std::strcmp("natural", k) == 0 &&
182-
std::strcmp("coastline", v) == 0) {
183-
add_area_tag = 1;
184-
185-
/* Discard natural=coastline tags (we render these from a shapefile instead) */
186-
if (!m_options->keep_coastlines) {
187-
continue;
188-
}
189-
}
190184
}
191185

192186
//go through the actual tags found on the item and keep the ones in the export list
193-
if (check_key(infos, k, &filter, &flags, strict)) {
187+
if (check_key(infos, k, &filter, &flags)) {
194188
out_tags.add_tag(k, v);
195189
}
196190
}

src/tagtransform-c.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class c_tagtransform_t : public tagtransform_t
2121
std::unique_ptr<tagtransform_t> clone() const override;
2222

2323
bool filter_tags(osmium::OSMObject const &o, int *polygon, int *roads,
24-
taglist_t &out_tags, bool strict = false) override;
24+
taglist_t &out_tags) override;
2525

2626
bool filter_rel_member_tags(taglist_t const &rel_tags,
2727
osmium::memory::Buffer const &members,
@@ -32,7 +32,7 @@ class c_tagtransform_t : public tagtransform_t
3232

3333
private:
3434
bool check_key(std::vector<taginfo> const &infos, char const *k,
35-
bool *filter, int *flags, bool strict);
35+
bool *filter, int *flags);
3636

3737
options_t const *m_options;
3838
export_list m_export_list;

src/tagtransform-lua.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void lua_tagtransform_t::check_lua_function_exists(std::string const &func_name)
6464
}
6565

6666
bool lua_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
67-
int *roads, taglist_t &out_tags, bool)
67+
int *roads, taglist_t &out_tags)
6868
{
6969
switch (o.type()) {
7070
case osmium::item_type::node:

src/tagtransform-lua.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class lua_tagtransform_t : public tagtransform_t
3030
std::unique_ptr<tagtransform_t> clone() const override;
3131

3232
bool filter_tags(osmium::OSMObject const &o, int *polygon, int *roads,
33-
taglist_t &out_tags, bool strict = false) override;
33+
taglist_t &out_tags) override;
3434

3535
bool filter_rel_member_tags(taglist_t const &rel_tags,
3636
osmium::memory::Buffer const &members,

src/tagtransform.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ class tagtransform_t
3030
virtual std::unique_ptr<tagtransform_t> clone() const = 0;
3131

3232
virtual bool filter_tags(osmium::OSMObject const &o, int *polygon,
33-
int *roads, taglist_t &out_tags,
34-
bool strict = false) = 0;
33+
int *roads, taglist_t &out_tags) = 0;
3534

3635
virtual bool filter_rel_member_tags(taglist_t const &rel_tags,
3736
osmium::memory::Buffer const &members,

0 commit comments

Comments
 (0)