Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2015-11-18 13:17:22 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:02:55 +0300
commit46fbd59cc43e036130678f0c0d77d5a2cb9521f9 (patch)
tree28caafbb9f94274a558bf64c8f48a576869058f7 /indexer/feature_data.cpp
parent330aee183867f37c2954c4011f9f2a4e55f8e9a2 (diff)
Review fixes.
Diffstat (limited to 'indexer/feature_data.cpp')
-rw-r--r--indexer/feature_data.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp
index a0bf7e1091..9dd042da2c 100644
--- a/indexer/feature_data.cpp
+++ b/indexer/feature_data.cpp
@@ -164,11 +164,6 @@ bool IsDummyName(string const & s)
s == "Edificio" || s == "edificio");
}
-struct IsBadChar
-{
- bool operator() (char c) const { return (c == '\n'); }
-};
-
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -224,19 +219,10 @@ bool FeatureParams::AddHouseNumber(string const & ss)
void FeatureParams::AddStreet(string s)
{
- // Erase bad chars (\n) because we write addresses to txt file.
- s.erase(remove_if(s.begin(), s.end(), IsBadChar()), s.end());
+ // Replace \n with spaces because we write addresses to txt file.
+ replace(s.begin(), s.end(), '\n', ' ');
- // Osm likes to put house numbers into addr:street field.
- size_t i = s.find_last_of("\t ");
- if (i != string::npos)
- {
- uint64_t n;
- if (strings::to_uint64(s.substr(i+1), n))
- s.erase(s.find_last_not_of("\t ", i)+1);
- }
-
- m_addrTags.Add(AddressData::FAD_STREET, s);
+ m_addrTags.Add(AddressData::STREET, s);
}
void FeatureParams::AddAddress(string const & s)
@@ -251,22 +237,26 @@ void FeatureParams::AddAddress(string const & s)
i = s.find_first_not_of("\t ", i);
}
else
+ {
i = 0;
+ }
}
else
+ {
i = 0;
+ }
- AddStreet(s.substr(i, s.size()-i));
+ AddStreet(s.substr(i, s.size() - i));
}
void FeatureParams::AddPlace(string const & s)
{
- m_addrTags.Add(AddressData::FAD_PLACE, s);
+ m_addrTags.Add(AddressData::PLACE, s);
}
void FeatureParams::AddPostcode(string const & s)
{
- m_addrTags.Add(AddressData::FAD_POSTCODE, s);
+ m_addrTags.Add(AddressData::POSTCODE, s);
}
bool FeatureParams::FormatFullAddress(m2::PointD const & pt, string & res) const
@@ -285,7 +275,7 @@ bool FeatureParams::FormatFullAddress(m2::PointD const & pt, string & res) const
string FeatureParams::GetStreet() const
{
- return m_addrTags.Get(AddressData::FAD_STREET);
+ return m_addrTags.Get(AddressData::STREET);
}
void FeatureParams::SetGeomType(feature::EGeomType t)