Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KOSMIndoorMap
Commits
220cd929
Commit
220cd929
authored
Dec 23, 2020
by
Volker Krause
Browse files
Make tags and tag keys generally comparable
We need that in multiple places.
parent
b0e9d066
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/osm/datatypes.h
View file @
220cd929
...
@@ -213,6 +213,9 @@ public:
...
@@ -213,6 +213,9 @@ public:
QByteArray
value
;
QByteArray
value
;
};
};
inline
constexpr
bool
operator
<
(
const
Tag
&
lhs
,
TagKey
rhs
)
{
return
lhs
.
key
<
rhs
;
}
inline
constexpr
bool
operator
<
(
TagKey
lhs
,
const
Tag
&
rhs
)
{
return
lhs
<
rhs
.
key
;
}
/** An OSM node. */
/** An OSM node. */
class
KOSM_EXPORT
Node
{
class
KOSM_EXPORT
Node
{
public:
public:
...
@@ -378,7 +381,7 @@ private:
...
@@ -378,7 +381,7 @@ private:
template
<
typename
Elem
>
template
<
typename
Elem
>
inline
QByteArray
tagValue
(
const
Elem
&
elem
,
TagKey
key
)
inline
QByteArray
tagValue
(
const
Elem
&
elem
,
TagKey
key
)
{
{
const
auto
it
=
std
::
lower_bound
(
elem
.
tags
.
begin
(),
elem
.
tags
.
end
(),
key
,
[](
const
auto
&
lhs
,
const
auto
&
rhs
)
{
return
lhs
.
key
<
rhs
;
}
);
const
auto
it
=
std
::
lower_bound
(
elem
.
tags
.
begin
(),
elem
.
tags
.
end
(),
key
);
if
(
it
!=
elem
.
tags
.
end
()
&&
(
*
it
).
key
==
key
)
{
if
(
it
!=
elem
.
tags
.
end
()
&&
(
*
it
).
key
==
key
)
{
return
(
*
it
).
value
;
return
(
*
it
).
value
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment