diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2018-04-28 19:00:39 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2018-05-07 18:03:39 +0300 |
commit | d0faaca2eaad4463f5e9bd68e9345a7e1e1e998d (patch) | |
tree | bb5b39b7858a89875a024fbff7dd0e1b9257e78b /indexer/ftypes_sponsored.cpp | |
parent | ee06a502da58304ee07c179048eade7a3a283cde (diff) |
Refactored partners
Diffstat (limited to 'indexer/ftypes_sponsored.cpp')
-rw-r--r-- | indexer/ftypes_sponsored.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/indexer/ftypes_sponsored.cpp b/indexer/ftypes_sponsored.cpp index 2a3fdedcd9..221f00e03b 100644 --- a/indexer/ftypes_sponsored.cpp +++ b/indexer/ftypes_sponsored.cpp @@ -1,15 +1,9 @@ #include "indexer/ftypes_sponsored.hpp" #include "indexer/classificator.hpp" -#include "indexer/feature.hpp" -#include "indexer/feature_data.hpp" - -#include "base/string_utils.hpp" #include "private.h" -#include <algorithm> - namespace ftypes { BaseSponsoredChecker::BaseSponsoredChecker(std::string const & sponsoredType) @@ -17,46 +11,8 @@ BaseSponsoredChecker::BaseSponsoredChecker(std::string const & sponsoredType) m_types.push_back(classif().GetTypeByPath({"sponsored", sponsoredType})); } -SponsoredPartnerChecker::SponsoredPartnerChecker() -{ - Classificator const & c = classif(); - for (size_t i = 1; i <= MAX_PARTNERS_COUNT; i++) - m_types.push_back(c.GetTypeByPath({"sponsored", "partner" + strings::to_string(i)})); -} - -int SponsoredPartnerChecker::GetPartnerIndex(FeatureType const & ft) const -{ - auto const types = feature::TypesHolder(ft); - int index = 0; - for (auto t : m_types) - { - if (std::find(types.begin(), types.end(), PrepareToMatch(t, 2 /* level */)) != types.end()) - return index; - index++; - } - return -1; -} - Fc2018Checker::Fc2018Checker() { m_types.push_back(classif().GetTypeByPath({"event", "fc2018"})); } } // namespace ftypes - -std::string GetPartnerNameByIndex(int partnerIndex) -{ - static std::vector<std::string> kIds = {PARTNER1_NAME, PARTNER2_NAME, PARTNER3_NAME, - PARTNER4_NAME, PARTNER5_NAME}; - if (partnerIndex < 0 || partnerIndex >= kIds.size()) - return {}; - return kIds[partnerIndex]; -} - -bool IsPartnerButtonExist(int partnerIndex) -{ - static std::vector<bool> kButtons = {PARTNER1_HAS_BUTTON, PARTNER2_HAS_BUTTON, PARTNER3_HAS_BUTTON, - PARTNER4_HAS_BUTTON, PARTNER5_HAS_BUTTON}; - if (partnerIndex < 0 || partnerIndex >= kButtons.size()) - return false; - return kButtons[partnerIndex]; -} |