diff options
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/ftypes_matcher.cpp | 12 | ||||
-rw-r--r-- | indexer/ftypes_matcher.hpp | 18 | ||||
-rw-r--r-- | indexer/indexer_tests/checker_test.cpp | 10 |
3 files changed, 31 insertions, 9 deletions
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index d34b2a73d2..b141bc6096 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -214,7 +214,7 @@ IsSuburbChecker::IsSuburbChecker() m_types.push_back(c.GetTypeByPath({"place", "suburb"})); } -IsStreetChecker::IsStreetChecker() +IsWayChecker::IsWayChecker() { // TODO (@y, @m, @vng): this list must be up-to-date with // data/categories.txt, so, it's worth it to generate or parse it @@ -243,6 +243,16 @@ IsStreetChecker::IsStreetChecker() m_types.push_back(c.GetTypeByPath({p[0], p[1]})); } +IsStreetOrSuburbChecker::IsStreetOrSuburbChecker() +{ + for (auto const t : IsWayChecker::Instance().m_types) + m_types.push_back(t); + for (auto const t : IsSquareChecker::Instance().m_types) + m_types.push_back(t); + for (auto const t : IsSuburbChecker::Instance().m_types) + m_types.push_back(t); +} + IsAddressObjectChecker::IsAddressObjectChecker() : BaseChecker(1 /* level */) { auto const paths = {"building", "amenity", "shop", "tourism", "historic", "office", "craft"}; diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp index 751d6de52f..018d0ed932 100644 --- a/indexer/ftypes_matcher.hpp +++ b/indexer/ftypes_matcher.hpp @@ -107,6 +107,7 @@ public: class IsSquareChecker : public BaseChecker { IsSquareChecker(); + friend class IsStreetOrSuburbChecker; public: DECLARE_CHECKER_INSTANCE(IsSquareChecker); @@ -115,16 +116,27 @@ public: class IsSuburbChecker : public BaseChecker { IsSuburbChecker(); + friend class IsStreetOrSuburbChecker; public: DECLARE_CHECKER_INSTANCE(IsSuburbChecker); }; -class IsStreetChecker : public BaseChecker +class IsWayChecker : public BaseChecker { - IsStreetChecker(); + IsWayChecker(); + friend class IsStreetOrSuburbChecker; + +public: + DECLARE_CHECKER_INSTANCE(IsWayChecker); +}; + +class IsStreetOrSuburbChecker : public BaseChecker +{ + IsStreetOrSuburbChecker(); + public: - DECLARE_CHECKER_INSTANCE(IsStreetChecker); + DECLARE_CHECKER_INSTANCE(IsStreetOrSuburbChecker); }; class IsAddressObjectChecker : public BaseChecker diff --git a/indexer/indexer_tests/checker_test.cpp b/indexer/indexer_tests/checker_test.cpp index 9dc695893b..19f14e6a34 100644 --- a/indexer/indexer_tests/checker_test.cpp +++ b/indexer/indexer_tests/checker_test.cpp @@ -179,17 +179,17 @@ UNIT_TEST(IsTypeConformed) TEST(!ftypes::IsTypeConformed(types[1], {"*", "building", "*"}), ()); } -UNIT_TEST(IsStreetChecker) +UNIT_TEST(IsWayChecker) { classificator::Load(); - TEST(ftypes::IsStreetChecker::Instance()(GetStreetTypes()), ()); - TEST(ftypes::IsStreetChecker::Instance()(GetStreetAndNotStreetTypes()), ()); + TEST(ftypes::IsWayChecker::Instance()(GetStreetTypes()), ()); + TEST(ftypes::IsWayChecker::Instance()(GetStreetAndNotStreetTypes()), ()); // TODO (@y, @m, @vng): need to investigate - do we really need this - // TEST for absence of links, because IsStreetChecker() is used for + // TEST for absence of links, because IsWayChecker() is used for // search only. // - // TEST(!ftypes::IsStreetChecker::Instance()(GetLinkTypes()), ()); + // TEST(!ftypes::IsWayChecker::Instance()(GetLinkTypes()), ()); } UNIT_TEST(IsLinkChecker) |