From c03c4f14944553b5de002b9e3ac6b9c36fb0766e Mon Sep 17 00:00:00 2001 From: Sergey Magidovich Date: Thu, 10 Dec 2015 13:49:28 +0300 Subject: [PATCH] Code review. --- editor/editor_tests/editor_tests.pro | 4 +++- editor/xml_feature.cpp | 19 ++++++++++--------- omim.pro | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/editor/editor_tests/editor_tests.pro b/editor/editor_tests/editor_tests.pro index 96da40e927..9d0056090b 100644 --- a/editor/editor_tests/editor_tests.pro +++ b/editor/editor_tests/editor_tests.pro @@ -4,10 +4,12 @@ CONFIG -= app_bundle TEMPLATE = app ROOT_DIR = ../.. -DEPENDENCIES += editor base coding geometry opening_hours pugixml +DEPENDENCIES = editor base coding geometry opening_hours pugixml include($$ROOT_DIR/common.pri) +QT *= core + HEADERS += \ SOURCES += \ diff --git a/editor/xml_feature.cpp b/editor/xml_feature.cpp index 24b5f714d2..1b830f0bb5 100644 --- a/editor/xml_feature.cpp +++ b/editor/xml_feature.cpp @@ -45,7 +45,7 @@ void ValidateNode(pugi::xml_node const & node) { PointFromLatLon(node); } - catch(editor::XMLFeatureError) + catch(editor::XMLFeatureError const &) { throw; } @@ -54,10 +54,11 @@ void ValidateNode(pugi::xml_node const & node) MYTHROW(editor::XMLFeatureNoTimestampError, ("Node has no timestamp attribute")); } -bool IsConvertable(string const & k, string const & v) +bool IsConvertible(string const & k, string const & v) { - static unordered_set, boost::hash>> const - convertableTypePairs = + using TStringPair = pair; + static unordered_set> const + convertibleTypePairs = { { "aeroway", "aerodrome" }, { "aeroway", "airport" }, @@ -189,14 +190,14 @@ bool IsConvertable(string const & k, string const & v) { "waterway", "waterfall" } }; - return convertableTypePairs.find(make_pair(k, v)) != end(convertableTypePairs); + return convertibleTypePairs.find(make_pair(k, v)) != end(convertibleTypePairs); } pair SplitMapsmeType(string const & type) { vector parts; boost::split(parts, type, boost::is_any_of("|")); - // Current implementations supports only types with one pipe + // Current implementations supports only types with one pipe. ASSERT(parts.size() == 2, ("Too many parts in type: " + type)); return make_pair(parts[0], parts[1]); } @@ -239,8 +240,8 @@ string XMLFeature::GetType() const { string const key = tag.node().attribute("k").value(); string const val = tag.node().attribute("v").value(); - // Handle only the first appropriate tag in first version - if (IsConvertable(key, val)) + // Handle only the first appropriate tag in first version. + if (IsConvertible(key, val)) return key + '|' + val; } @@ -250,7 +251,7 @@ string XMLFeature::GetType() const void XMLFeature::SetType(string const & type) { auto const p = SplitMapsmeType(type); - if (IsConvertable(p.first, p.second)) + if (IsConvertible(p.first, p.second)) SetTagValue(p.first, p.second); } diff --git a/omim.pro b/omim.pro index aef71f2cc3..b4e71d2e80 100644 --- a/omim.pro +++ b/omim.pro @@ -160,7 +160,7 @@ SUBDIRS = 3party base coding geometry editor indexer routing search SUBDIRS *= generator_tests editor_tests.subdir = editor/editor_tests - editor_tests.depends = 3party base coding editor geometry + editor_tests.depends = 3party base coding geometry editor SUBDIRS *= editor_tests SUBDIRS *= qt_tstfrm