diff options
author | Maxim Pimenov <m@maps.me> | 2018-09-14 21:08:09 +0300 |
---|---|---|
committer | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2018-09-18 14:46:56 +0300 |
commit | 412387c84eefba2ec4c267ee2748bf78f03ce327 (patch) | |
tree | 8d79b6b480fb91a5458a21aec10ac689de54db9f /search | |
parent | bef147b46fb8fd5160fc8e3b13f3548906ae5ef7 (diff) |
[base] Replaced the namespace my with base.
Diffstat (limited to 'search')
24 files changed, 147 insertions, 144 deletions
diff --git a/search/bookmarks/processor.hpp b/search/bookmarks/processor.hpp index cc09a2dbf8..a2c670ccf4 100644 --- a/search/bookmarks/processor.hpp +++ b/search/bookmarks/processor.hpp @@ -15,7 +15,7 @@ #include <utility> #include <vector> -namespace my +namespace base { class Cancellable; } diff --git a/search/cbv.cpp b/search/cbv.cpp index 437abe7c36..3e94ac5a32 100644 --- a/search/cbv.cpp +++ b/search/cbv.cpp @@ -1,9 +1,9 @@ #include "search/cbv.hpp" -#include "std/limits.hpp" -#include "std/vector.hpp" +#include <limits> +#include <vector> -using namespace my; +using namespace std; namespace search { diff --git a/search/cbv.hpp b/search/cbv.hpp index b52ff839f6..6fc6d4c381 100644 --- a/search/cbv.hpp +++ b/search/cbv.hpp @@ -4,8 +4,9 @@ #include "base/ref_counted.hpp" -#include "std/function.hpp" -#include "std/utility.hpp" +#include <cstdint> +#include <memory> +#include <utility> namespace search { @@ -16,12 +17,12 @@ class CBV { public: CBV() = default; - explicit CBV(unique_ptr<coding::CompressedBitVector> p); + explicit CBV(std::unique_ptr<coding::CompressedBitVector> p); CBV(CBV const & cbv) = default; CBV(CBV && cbv); inline operator bool() const { return !IsEmpty(); } - CBV & operator=(unique_ptr<coding::CompressedBitVector> p); + CBV & operator=(std::unique_ptr<coding::CompressedBitVector> p); CBV & operator=(CBV const & rhs) = default; CBV & operator=(CBV && rhs); @@ -34,12 +35,12 @@ public: bool HasBit(uint64_t id) const; uint64_t PopCount() const; - template <class TFn> - void ForEach(TFn && fn) const + template <typename Fn> + void ForEach(Fn && fn) const { ASSERT(!m_isFull, ()); if (!IsEmpty()) - coding::CompressedBitVectorEnumerator::ForEach(*m_p, forward<TFn>(fn)); + coding::CompressedBitVectorEnumerator::ForEach(*m_p, std::forward<Fn>(fn)); } CBV Union(CBV const & rhs) const; @@ -51,7 +52,7 @@ public: uint64_t Hash() const; private: - my::RefCountPtr<coding::CompressedBitVector> m_p; + base::RefCountPtr<coding::CompressedBitVector> m_p; // True iff all bits are set to one. bool m_isFull = false; diff --git a/search/features_layer_path_finder.hpp b/search/features_layer_path_finder.hpp index b6dfb440be..6ccf082d2a 100644 --- a/search/features_layer_path_finder.hpp +++ b/search/features_layer_path_finder.hpp @@ -60,7 +60,7 @@ public: #if defined(DEBUG) for (auto const * layer : layers) LOG(LINFO, (DebugPrint(*layer))); - my::Timer timer; + base::Timer timer; #endif // defined(DEBUG) std::vector<IntersectionResult> results; diff --git a/search/geocoder.cpp b/search/geocoder.cpp index 50aef21ca9..9feea7e816 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -404,7 +404,7 @@ void Geocoder::GoEverywhere() // TODO (@y): remove following code as soon as Geocoder::Go() will // work fast for most cases (significantly less than 1 second). #if defined(DEBUG) - my::Timer timer; + base::Timer timer; MY_SCOPE_GUARD(printDuration, [&timer]() { LOG(LINFO, ("Total geocoding time:", timer.ElapsedSeconds(), "seconds")); diff --git a/search/house_detector.cpp b/search/house_detector.cpp index d98be7eec2..81741604b4 100644 --- a/search/house_detector.cpp +++ b/search/house_detector.cpp @@ -856,8 +856,8 @@ int HouseDetector::LoadStreets(vector<FeatureID> const & ids) // Check if the cache is obsolete and need to be cleared. if (!m_id2st.empty()) { - typedef pair<FeatureID, Street *> ValueT; - function<ValueT::first_type const &(ValueT const &)> f = bind(&ValueT::first, _1); + using Value = pair<FeatureID, Street *>; + function<Value::first_type const &(Value const &)> f = bind(&Value::first, _1); // Do clear cache if we have elements that are present in the one set, // but not in the other one (set's order is irrelevant). @@ -1050,8 +1050,8 @@ void MergedStreet::FinishReadingHouses() HouseProjection const * MergedStreet::GetHousePivot(bool isOdd, bool & sign) const { - typedef my::limited_priority_queue<HouseProjection const *, HouseProjection::LessDistance> QueueT; - QueueT q(HN_COUNT_FOR_ODD_TEST); + using Queue = base::limited_priority_queue<HouseProjection const *, HouseProjection::LessDistance>; + Queue q(HN_COUNT_FOR_ODD_TEST); // Get some most closest houses. for (MergedStreet::Index i = Begin(); !IsEnd(i); Inc(i)) @@ -1060,7 +1060,7 @@ HouseProjection const * MergedStreet::GetHousePivot(bool isOdd, bool & sign) con // Calculate all probabilities. // even-left, odd-left, even-right, odd-right double counter[4] = {0, 0, 0, 0}; - for (QueueT::const_iterator i = q.begin(); i != q.end(); ++i) + for (Queue::const_iterator i = q.begin(); i != q.end(); ++i) { size_t ind = (*i)->m_house->GetIntNumber() % 2; if ((*i)->m_projSign) diff --git a/search/intermediate_result.cpp b/search/intermediate_result.cpp index b53f2a2ab0..face3131b2 100644 --- a/search/intermediate_result.cpp +++ b/search/intermediate_result.cpp @@ -209,7 +209,7 @@ void ProcessMetadata(FeatureType & ft, Result::Metadata & meta) } if (strings::to_int(src.Get(feature::Metadata::FMD_STARS), meta.m_stars)) - meta.m_stars = my::clamp(meta.m_stars, 0, 5); + meta.m_stars = base::clamp(meta.m_stars, 0, 5); else meta.m_stars = 0; diff --git a/search/interval_set.hpp b/search/interval_set.hpp index a6db719bbb..775112c48a 100644 --- a/search/interval_set.hpp +++ b/search/interval_set.hpp @@ -5,59 +5,60 @@ #include "std/utility.hpp" #include "std/vector.hpp" -namespace my +// todo(@m) Move to search/base? +namespace search { // This class represents a set of disjoint intervals in the form // [begin, end). Note that neighbour intervals are always coalesced, // so while [0, 1), [1, 2) and [2, 3) are disjoint, after addition to // the set they will be stored as a single [0, 3). -template <typename TElem> +template <typename Elem> class IntervalSet { public: - using TInterval = pair<TElem, TElem>; + using Interval = pair<Elem, Elem>; // Adds an |interval| to the set, coalescing adjacent intervals if needed. // // Complexity: O(num of intervals intersecting with |interval| + // log(total number of intervals)). - void Add(TInterval const & interval); + void Add(Interval const & interval); // Subtracts set from an |interval| and appends result to // |difference|. // // Complexity: O(num of intervals intersecting with |interval| + // log(total number of intervals)). - void SubtractFrom(TInterval const & interval, vector<TInterval> & difference) const; + void SubtractFrom(Interval const & interval, vector<Interval> & difference) const; // Returns all elements of the set as a set of intervals. // // Complexity: O(1). - inline set<TInterval> const & Elems() const { return m_intervals; } + inline set<Interval> const & Elems() const { return m_intervals; } private: - using TIterator = typename set<TInterval>::iterator; + using Iterator = typename set<Interval>::iterator; // Calculates range of intervals that have non-empty intersection with a given |interval|. - void Cover(TInterval const & interval, TIterator & begin, TIterator & end) const; + void Cover(Interval const & interval, Iterator & begin, Iterator & end) const; // This is a set of disjoint intervals. - set<TInterval> m_intervals; + set<Interval> m_intervals; }; -template <typename TElem> -void IntervalSet<TElem>::Add(TInterval const & interval) +template <typename Elem> +void IntervalSet<Elem>::Add(Interval const & interval) { // Skips empty intervals. if (interval.first == interval.second) return; - TIterator begin; - TIterator end; + Iterator begin; + Iterator end; Cover(interval, begin, end); - TElem from = interval.first; - TElem to = interval.second; + Elem from = interval.first; + Elem to = interval.second; // Updates |from| and |to| in accordance with corner intervals (if any). if (begin != end) @@ -95,17 +96,17 @@ void IntervalSet<TElem>::Add(TInterval const & interval) m_intervals.emplace(from, to); } -template <typename TElem> -void IntervalSet<TElem>::SubtractFrom(TInterval const & interval, - vector<TInterval> & difference) const +template <typename Elem> +void IntervalSet<Elem>::SubtractFrom(Interval const & interval, + vector<Interval> & difference) const { - TIterator begin; - TIterator end; + Iterator begin; + Iterator end; Cover(interval, begin, end); - TElem from = interval.first; - TElem const to = interval.second; + Elem from = interval.first; + Elem const to = interval.second; for (auto it = begin; it != end && from < to; ++it) { @@ -124,11 +125,11 @@ void IntervalSet<TElem>::SubtractFrom(TInterval const & interval, difference.emplace_back(from, to); } -template <typename TElem> -void IntervalSet<TElem>::Cover(TInterval const & interval, TIterator & begin, TIterator & end) const +template <typename Elem> +void IntervalSet<Elem>::Cover(Interval const & interval, Iterator & begin, Iterator & end) const { - TElem const & from = interval.first; - TElem const & to = interval.second; + Elem const & from = interval.first; + Elem const & to = interval.second; begin = m_intervals.lower_bound(make_pair(from, from)); if (begin != m_intervals.begin()) @@ -141,4 +142,4 @@ void IntervalSet<TElem>::Cover(TInterval const & interval, TIterator & begin, TI end = m_intervals.lower_bound(make_pair(to, to)); } -} // namespace my +} // namespace search diff --git a/search/pre_ranker.cpp b/search/pre_ranker.cpp index 315b167c74..1d07bac79f 100644 --- a/search/pre_ranker.cpp +++ b/search/pre_ranker.cpp @@ -267,10 +267,10 @@ void PreRanker::FilterForViewportSearch() { auto const & p = m_results[i].GetInfo().m_center; int dx = static_cast<int>((p.x - viewport.minX()) / sizeX * kNumXSlots); - dx = my::clamp(dx, 0, static_cast<int>(kNumXSlots) - 1); + dx = base::clamp(dx, 0, static_cast<int>(kNumXSlots) - 1); int dy = static_cast<int>((p.y - viewport.minY()) / sizeY * kNumYSlots); - dy = my::clamp(dy, 0, static_cast<int>(kNumYSlots) - 1); + dy = base::clamp(dy, 0, static_cast<int>(kNumYSlots) - 1); buckets[dx * kNumYSlots + dy].push_back(i); } diff --git a/search/pysearch/bindings.cpp b/search/pysearch/bindings.cpp index e61f90808c..d8fe78b85e 100644 --- a/search/pysearch/bindings.cpp +++ b/search/pysearch/bindings.cpp @@ -66,7 +66,7 @@ void Init(string const & resource_path, string const & mwm_path) if (!resource_path.empty()) { platform.SetResourceDir(resource_path); - countriesFile = my::JoinFoldersToPath(resource_path, COUNTRIES_FILE); + countriesFile = base::JoinFoldersToPath(resource_path, COUNTRIES_FILE); } if (!mwm_path.empty()) diff --git a/search/result.cpp b/search/result.cpp index 1289dd6732..13689c6d0c 100644 --- a/search/result.cpp +++ b/search/result.cpp @@ -276,7 +276,7 @@ void Results::InsertResult(vector<Result>::iterator where, Result && result) string DebugPrint(search::Results const & results) { - return ::my::impl::DebugPrintSequence(results.begin(), results.end()); + return DebugPrintSequence(results.begin(), results.end()); } // AddressInfo ------------------------------------------------------------------------------------- diff --git a/search/search_integration_tests/pre_ranker_test.cpp b/search/search_integration_tests/pre_ranker_test.cpp index de63a4029d..1bd90d291b 100644 --- a/search/search_integration_tests/pre_ranker_test.cpp +++ b/search/search_integration_tests/pre_ranker_test.cpp @@ -164,7 +164,7 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke) TEST_LESS(index, pois.size(), ()); TEST(!checked[index], (index)); - TEST(my::AlmostEqualAbs(distances[index], results[i].GetDistance(), 1e-3), + TEST(base::AlmostEqualAbs(distances[index], results[i].GetDistance(), 1e-3), (distances[index], results[i].GetDistance())); checked[index] = true; } diff --git a/search/search_quality/features_collector_tool/features_collector_tool.cpp b/search/search_quality/features_collector_tool/features_collector_tool.cpp index ba4f7b9f09..a8da701662 100644 --- a/search/search_quality/features_collector_tool/features_collector_tool.cpp +++ b/search/search_quality/features_collector_tool/features_collector_tool.cpp @@ -114,7 +114,7 @@ int main(int argc, char * argv[]) if (!FLAGS_data_path.empty()) { platform.SetResourceDir(FLAGS_data_path); - countriesFile = my::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE); + countriesFile = base::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE); } if (!FLAGS_mwm_path.empty()) diff --git a/search/search_quality/helpers.cpp b/search/search_quality/helpers.cpp index a0aa3e4031..f030c5c04f 100644 --- a/search/search_quality/helpers.cpp +++ b/search/search_quality/helpers.cpp @@ -32,7 +32,7 @@ namespace m2 { void FromJSONObject(json_t * root, string const & field, RectD & rect) { - json_t * r = my::GetJSONObligatoryField(root, field); + json_t * r = base::GetJSONObligatoryField(root, field); double minX, minY, maxX, maxY; FromJSONObject(r, "minx", minX); FromJSONObject(r, "miny", minY); @@ -46,7 +46,7 @@ void FromJSONObject(json_t * root, string const & field, RectD & rect) void ToJSONObject(json_t & root, string const & field, RectD const & rect) { - auto json = my::NewJSONObject(); + auto json = base::NewJSONObject(); ToJSONObject(*json, "minx", rect.minX()); ToJSONObject(*json, "miny", rect.minY()); ToJSONObject(*json, "maxx", rect.maxX()); @@ -56,14 +56,14 @@ void ToJSONObject(json_t & root, string const & field, RectD const & rect) void FromJSONObject(json_t * root, string const & field, PointD & point) { - json_t * p = my::GetJSONObligatoryField(root, field); + json_t * p = base::GetJSONObligatoryField(root, field); ParsePoint(p, point); } bool FromJSONObjectOptional(json_t * root, std::string const & field, PointD & point) { - json_t * p = my::GetJSONOptionalField(root, field); - if (!p || my::JSONIsNull(p)) + json_t * p = base::GetJSONOptionalField(root, field); + if (!p || base::JSONIsNull(p)) return false; ParsePoint(p, point); @@ -72,7 +72,7 @@ bool FromJSONObjectOptional(json_t * root, std::string const & field, PointD & p void ToJSONObject(json_t & root, string const & field, PointD const & point) { - auto json = my::NewJSONObject(); + auto json = base::NewJSONObject(); ToJSONObject(*json, "x", point.x); ToJSONObject(*json, "y", point.y); json_object_set_new(&root, field.c_str(), json.release()); diff --git a/search/search_quality/sample.cpp b/search/search_quality/sample.cpp index be9fa5ae44..693ed8f44b 100644 --- a/search/search_quality/sample.cpp +++ b/search/search_quality/sample.cpp @@ -16,7 +16,7 @@ #include <sstream> #include <string> -using namespace my; +using namespace base; using namespace std; namespace @@ -93,20 +93,20 @@ bool Sample::DeserializeFromJSON(string const & jsonStr) { try { - my::Json root(jsonStr.c_str()); + base::Json root(jsonStr.c_str()); DeserializeFromJSONImpl(root.get()); return true; } - catch (my::Json::Exception const & e) + catch (base::Json::Exception const & e) { LOG(LWARNING, ("Can't parse sample:", e.Msg(), jsonStr)); } return false; } -my::JSONPtr Sample::SerializeToJSON() const +base::JSONPtr Sample::SerializeToJSON() const { - auto json = my::NewJSONObject(); + auto json = base::NewJSONObject(); SerializeToJSONImpl(*json); return json; } @@ -238,9 +238,9 @@ void FromJSON(json_t * root, Sample::Result & result) FromJSONObject(root, "relevancy", result.m_relevance); } -my::JSONPtr ToJSON(Sample::Result const & result) +base::JSONPtr ToJSON(Sample::Result const & result) { - auto root = my::NewJSONObject(); + auto root = base::NewJSONObject(); ToJSONObject(*root, "position", result.m_pos); ToJSONObject(*root, "name", result.m_name); ToJSONObject(*root, "houseNumber", result.m_houseNumber); diff --git a/search/search_quality/sample.hpp b/search/search_quality/sample.hpp index 0532edf093..d63ed37d89 100644 --- a/search/search_quality/sample.hpp +++ b/search/search_quality/sample.hpp @@ -42,7 +42,7 @@ struct Sample }; bool DeserializeFromJSON(std::string const & jsonStr); - my::JSONPtr SerializeToJSON() const; + base::JSONPtr SerializeToJSON() const; static bool DeserializeFromJSONLines(std::string const & lines, std::vector<Sample> & samples); static void SerializeToJSONLines(std::vector<Sample> const & samples, std::string & lines); @@ -70,7 +70,7 @@ void FromJSONObject(json_t * root, std::string const & field, void ToJSONObject(json_t & root, std::string const & field, Sample::Result::Relevance relevance); void FromJSON(json_t * root, Sample::Result & result); -my::JSONPtr ToJSON(Sample::Result const & result); +base::JSONPtr ToJSON(Sample::Result const & result); std::string DebugPrint(Sample::Result::Relevance r); diff --git a/search/search_quality/search_quality_tool/search_quality_tool.cpp b/search/search_quality/search_quality_tool/search_quality_tool.cpp index 4b08a69260..6f09d47b7c 100644 --- a/search/search_quality/search_quality_tool/search_quality_tool.cpp +++ b/search/search_quality/search_quality_tool/search_quality_tool.cpp @@ -217,7 +217,7 @@ int FindResult(DataSource & dataSource, string const & mwmName, uint32_t const f { auto const & r = results[i]; if (r.HasPoint() && - my::AlmostEqualAbs(r.GetFeatureCenter(), MercatorBounds::FromLatLon(lat, lon), kEps)) + base::AlmostEqualAbs(r.GetFeatureCenter(), MercatorBounds::FromLatLon(lat, lon), kEps)) { double const dist = MercatorBounds::DistanceOnEarth(r.GetFeatureCenter(), MercatorBounds::FromLatLon(lat, lon)); @@ -282,12 +282,12 @@ void ParseCompletenessQuery(string & s, CompletenessQuery & q) void CheckCompleteness(string const & path, m2::RectD const & viewport, DataSource & dataSource, TestSearchEngine & engine) { - my::ScopedLogAbortLevelChanger const logAbortLevel(LCRITICAL); + base::ScopedLogAbortLevelChanger const logAbortLevel(LCRITICAL); ifstream stream(path.c_str()); CHECK(stream.is_open(), ("Can't open", path)); - my::Timer timer; + base::Timer timer; uint32_t totalQueries = 0; uint32_t malformedQueries = 0; @@ -359,7 +359,7 @@ int main(int argc, char * argv[]) if (!FLAGS_data_path.empty()) { platform.SetResourceDir(FLAGS_data_path); - countriesFile = my::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE); + countriesFile = base::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE); } if (!FLAGS_mwm_path.empty()) @@ -432,7 +432,7 @@ int main(int argc, char * argv[]) vector<string> queries; string queriesPath = FLAGS_queries_path; if (queriesPath.empty()) - queriesPath = my::JoinFoldersToPath(platform.WritableDir(), kDefaultQueriesPathSuffix); + queriesPath = base::JoinFoldersToPath(platform.WritableDir(), kDefaultQueriesPathSuffix); ReadStringsFromFile(queriesPath, queries); vector<unique_ptr<TestSearchRequest>> requests; diff --git a/search/search_tests/interval_set_test.cpp b/search/search_tests/interval_set_test.cpp index b22f73c1ce..d0d7907384 100644 --- a/search/search_tests/interval_set_test.cpp +++ b/search/search_tests/interval_set_test.cpp @@ -2,124 +2,126 @@ #include "search/interval_set.hpp" -#include "std/initializer_list.hpp" +#include <initializer_list> +#include <set> +#include <vector> -using namespace my; +using namespace base; namespace { -template <typename TElem> -using TInterval = typename IntervalSet<TElem>::TInterval; +template <typename Elem> +using Interval = typename search::IntervalSet<Elem>::Interval; -template <typename TElem> -void CheckSet(IntervalSet<TElem> const & actual, initializer_list<TInterval<TElem>> intervals) +template <typename Elem> +void CheckSet(search::IntervalSet<Elem> const & actual, std::initializer_list<Interval<Elem>> intervals) { - set<TInterval<TElem>> expected(intervals); + std::set<Interval<Elem>> expected(intervals); TEST_EQUAL(actual.Elems(), expected, ()); } } // namespace UNIT_TEST(IntervalSet_Add) { - IntervalSet<int> set; + search::IntervalSet<int> set; TEST(set.Elems().empty(), ()); - set.Add(TInterval<int>(0, 2)); - CheckSet(set, {TInterval<int>(0, 2)}); + set.Add(Interval<int>(0, 2)); + CheckSet(set, {Interval<int>(0, 2)}); - set.Add(TInterval<int>(1, 3)); - CheckSet(set, {TInterval<int>(0, 3)}); + set.Add(Interval<int>(1, 3)); + CheckSet(set, {Interval<int>(0, 3)}); - set.Add(TInterval<int>(-2, 0)); - CheckSet(set, {TInterval<int>(-2, 3)}); + set.Add(Interval<int>(-2, 0)); + CheckSet(set, {Interval<int>(-2, 3)}); - set.Add(TInterval<int>(-4, -3)); - CheckSet(set, {TInterval<int>(-4, -3), TInterval<int>(-2, 3)}); + set.Add(Interval<int>(-4, -3)); + CheckSet(set, {Interval<int>(-4, -3), Interval<int>(-2, 3)}); - set.Add(TInterval<int>(7, 10)); - CheckSet(set, {TInterval<int>(-4, -3), TInterval<int>(-2, 3), TInterval<int>(7, 10)}); + set.Add(Interval<int>(7, 10)); + CheckSet(set, {Interval<int>(-4, -3), Interval<int>(-2, 3), Interval<int>(7, 10)}); - set.Add(TInterval<int>(-3, -2)); - CheckSet(set, {TInterval<int>(-4, 3), TInterval<int>(7, 10)}); + set.Add(Interval<int>(-3, -2)); + CheckSet(set, {Interval<int>(-4, 3), Interval<int>(7, 10)}); - set.Add(TInterval<int>(2, 8)); - CheckSet(set, {TInterval<int>(-4, 10)}); + set.Add(Interval<int>(2, 8)); + CheckSet(set, {Interval<int>(-4, 10)}); - set.Add(TInterval<int>(2, 3)); - CheckSet(set, {TInterval<int>(-4, 10)}); + set.Add(Interval<int>(2, 3)); + CheckSet(set, {Interval<int>(-4, 10)}); } UNIT_TEST(IntervalSet_AdjacentIntervalAdd) { - IntervalSet<int> set; + search::IntervalSet<int> set; TEST(set.Elems().empty(), ()); - set.Add(TInterval<int>(100, 106)); - CheckSet(set, {TInterval<int>(100, 106)}); + set.Add(Interval<int>(100, 106)); + CheckSet(set, {Interval<int>(100, 106)}); - set.Add(TInterval<int>(106, 110)); - CheckSet(set, {TInterval<int>(100, 110)}); + set.Add(Interval<int>(106, 110)); + CheckSet(set, {Interval<int>(100, 110)}); - set.Add(TInterval<int>(90, 100)); - CheckSet(set, {TInterval<int>(90, 110)}); + set.Add(Interval<int>(90, 100)); + CheckSet(set, {Interval<int>(90, 110)}); } UNIT_TEST(IntervalSet_SubtractFrom) { - IntervalSet<int> set; + search::IntervalSet<int> set; TEST(set.Elems().empty(), ()); - set.Add(TInterval<int>(0, 2)); - set.Add(TInterval<int>(4, 7)); - set.Add(TInterval<int>(10, 11)); + set.Add(Interval<int>(0, 2)); + set.Add(Interval<int>(4, 7)); + set.Add(Interval<int>(10, 11)); - CheckSet(set, {TInterval<int>(0, 2), TInterval<int>(4, 7), TInterval<int>(10, 11)}); + CheckSet(set, {Interval<int>(0, 2), Interval<int>(4, 7), Interval<int>(10, 11)}); { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(1, 5), difference); - vector<TInterval<int>> expected{TInterval<int>(2, 4)}; + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(1, 5), difference); + std::vector<Interval<int>> expected{Interval<int>(2, 4)}; TEST_EQUAL(difference, expected, ()); } { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(-10, -5), difference); - vector<TInterval<int>> expected{TInterval<int>(-10, -5)}; + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(-10, -5), difference); + std::vector<Interval<int>> expected{Interval<int>(-10, -5)}; TEST_EQUAL(difference, expected, ()); } { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(0, 11), difference); - vector<TInterval<int>> expected{TInterval<int>(2, 4), TInterval<int>(7, 10)}; + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(0, 11), difference); + std::vector<Interval<int>> expected{Interval<int>(2, 4), Interval<int>(7, 10)}; TEST_EQUAL(difference, expected, ()); } { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(-1, 11), difference); - vector<TInterval<int>> expected{TInterval<int>(-1, 0), TInterval<int>(2, 4), - TInterval<int>(7, 10)}; + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(-1, 11), difference); + std::vector<Interval<int>> expected{Interval<int>(-1, 0), Interval<int>(2, 4), + Interval<int>(7, 10)}; TEST_EQUAL(difference, expected, ()); } { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(5, 7), difference); + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(5, 7), difference); TEST(difference.empty(), ()); } { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(4, 7), difference); + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(4, 7), difference); TEST(difference.empty(), ()); } { - vector<TInterval<int>> difference; - set.SubtractFrom(TInterval<int>(3, 7), difference); - vector<TInterval<int>> expected{TInterval<int>(3, 4)}; + std::vector<Interval<int>> difference; + set.SubtractFrom(Interval<int>(3, 7), difference); + std::vector<Interval<int>> expected{Interval<int>(3, 4)}; TEST_EQUAL(difference, expected, ()); } } diff --git a/search/search_tests/keyword_matcher_test.cpp b/search/search_tests/keyword_matcher_test.cpp index 0132f1f4ac..f6655b6a44 100644 --- a/search/search_tests/keyword_matcher_test.cpp +++ b/search/search_tests/keyword_matcher_test.cpp @@ -9,12 +9,14 @@ #include "base/buffer_vector.hpp" #include "base/stl_helpers.hpp" -#include "std/sstream.hpp" -#include "std/vector.hpp" +#include <sstream> +#include <string> +#include <vector> + +using namespace std; namespace { - using search::KeywordMatcher; using search::kMaxNumTokens; @@ -131,9 +133,7 @@ void TestKeywordMatcher(char const * const query, KeywordMatcherTestCase const ( prevScore = testScore; } } - -} // unnamed namespace - +} // namespace UNIT_TEST(KeywordMatcher_Prefix) { @@ -246,7 +246,6 @@ UNIT_TEST(KeywordMatcher_KeywordAndKeyword) namespace { - string GetManyTokens(string tokenPrefix, int tokenCount, bool countForward = true) { ostringstream out; diff --git a/search/search_tests/latlon_match_test.cpp b/search/search_tests/latlon_match_test.cpp index d91df5379f..2f59288668 100644 --- a/search/search_tests/latlon_match_test.cpp +++ b/search/search_tests/latlon_match_test.cpp @@ -13,7 +13,7 @@ double const kEps = 1e-12; void TestAlmostEqual(double actual, double expected) { - TEST(my::AlmostEqualAbsOrRel(actual, expected, kEps), (actual, expected)); + TEST(base::AlmostEqualAbsOrRel(actual, expected, kEps), (actual, expected)); } UNIT_TEST(LatLon_Degree_Match) diff --git a/search/search_tests_support/helpers.hpp b/search/search_tests_support/helpers.hpp index a14996c91b..7580bb5874 100644 --- a/search/search_tests_support/helpers.hpp +++ b/search/search_tests_support/helpers.hpp @@ -51,7 +51,7 @@ public: protected: void OnMwmBuilt(MwmInfo const & /* info */) override; - my::ScopedLogLevelChanger m_scopedLog; + base::ScopedLogLevelChanger m_scopedLog; tests_support::TestSearchEngine m_engine; diff --git a/search/search_tests_support/test_search_request.hpp b/search/search_tests_support/test_search_request.hpp index 8895098287..9f686cf8be 100644 --- a/search/search_tests_support/test_search_request.hpp +++ b/search/search_tests_support/test_search_request.hpp @@ -62,7 +62,7 @@ protected: vector<search::Result> m_results; bool m_done = false; - my::Timer m_timer; + base::Timer m_timer; steady_clock::duration m_startTime; steady_clock::duration m_endTime; diff --git a/search/street_vicinity_loader.cpp b/search/street_vicinity_loader.cpp index f33244277d..55bf2eca98 100644 --- a/search/street_vicinity_loader.cpp +++ b/search/street_vicinity_loader.cpp @@ -25,7 +25,7 @@ void StreetVicinityLoader::SetContext(MwmContext * context) m_context = context; auto const scaleRange = m_context->m_value.GetHeader().GetScaleRange(); - m_scale = my::clamp(m_scale, scaleRange.first, scaleRange.second); + m_scale = base::clamp(m_scale, scaleRange.first, scaleRange.second); } void StreetVicinityLoader::OnQueryFinished() { m_cache.ClearIfNeeded(); } diff --git a/search/token_range.hpp b/search/token_range.hpp index 03865fca5f..4ea26a967e 100644 --- a/search/token_range.hpp +++ b/search/token_range.hpp @@ -62,11 +62,11 @@ public: inline size_t Begin() const { return m_begin; } inline size_t End() const { return m_end; } - inline my::RangeIterator<size_t> begin() const { return my::RangeIterator<size_t>(m_begin); } - inline my::RangeIterator<size_t> end() const { return my::RangeIterator<size_t>(m_end); } + inline base::RangeIterator<size_t> begin() const { return base::RangeIterator<size_t>(m_begin); } + inline base::RangeIterator<size_t> end() const { return base::RangeIterator<size_t>(m_end); } - inline my::RangeIterator<size_t> cbegin() const { return my::RangeIterator<size_t>(m_begin); } - inline my::RangeIterator<size_t> cend() const { return my::RangeIterator<size_t>(m_end); } + inline base::RangeIterator<size_t> cbegin() const { return base::RangeIterator<size_t>(m_begin); } + inline base::RangeIterator<size_t> cend() const { return base::RangeIterator<size_t>(m_end); } private: friend std::string DebugPrint(TokenRange const & tokenRange); |