Small fixes for review
Signed-off-by: Anton Makouski <anton.makouski@gmail.com>
This commit is contained in:
parent
d7cde8cce1
commit
ee3bfa0d20
2 changed files with 13 additions and 16 deletions
|
@ -148,7 +148,18 @@ string MetadataTagProcessorImpl::ValidateAndFormat_ele(string const & v) const
|
|||
|
||||
string MetadataTagProcessorImpl::ValidateAndFormat_destination(string const & v) const
|
||||
{
|
||||
return v;
|
||||
{
|
||||
// Normalization. "a1 a2;b1-b2; c,d " " -> "a1 a2; b1-b2; c; d".
|
||||
string r;
|
||||
strings::Tokenize(v, ";,", [&](std::string_view d)
|
||||
{
|
||||
if (r.empty())
|
||||
r = strings::Trim(d);
|
||||
else
|
||||
r += "; " + string(strings::Trim(d));
|
||||
});
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
string MetadataTagProcessorImpl::ValidateAndFormat_destination_ref(string const & v) const
|
||||
|
|
|
@ -341,20 +341,6 @@ SessionState RoutingSession::OnLocationPositionChanged(GpsInfo const & info)
|
|||
return m_state;
|
||||
}
|
||||
|
||||
string FormatRoadDestination(string const & v)
|
||||
{
|
||||
// Normalization. "a ;b; c,d " " -> "a; b; c; d".
|
||||
string r;
|
||||
strings::Tokenize(v, " ;,", [&](std::string_view d)
|
||||
{
|
||||
if (r.empty())
|
||||
r = d;
|
||||
else
|
||||
r += "; " + string(d);
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
// For next street returns "[ref] name" .
|
||||
// For highway exits (or main roads with exit info) returns "[junction:ref]: [target:ref] > target".
|
||||
// If no |target| - it will be replaced by |name| of next street.
|
||||
|
@ -377,7 +363,7 @@ void GetFullRoadName(RouteSegment::RoadNameInfo & road, string & name)
|
|||
name += string(name.empty() ? "" : ": ") + "[" + road.m_destination_ref + "]";
|
||||
|
||||
if (!road.m_destination.empty())
|
||||
name += string(name.empty() ? "" : " ") + "> " + FormatRoadDestination(road.m_destination);
|
||||
name += string(name.empty() ? "" : " ") + "> " + road.m_destination;
|
||||
else if (!road.m_name.empty())
|
||||
name += (road.m_destination_ref.empty() ? string(name.empty() ? "" : " ") : ": ") + road.m_name;
|
||||
}
|
||||
|
|
Reference in a new issue