/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
android-google-915
routing/restrictions_serialization.cpp
55 строк
1 KB
tatiana-yan
[std] Use new include style for routing
10 апр 2019, 15:01
10 апр 2019, 15:01
7b01098
Код
Авторство
О чём код?
#include "routing/restrictions_serialization.hpp" #include <sstream> using namespace std; namespace { char const kNo[] = "No"; char const kOnly[] = "Only"; } // namespace namespace routing { // static uint32_t const Restriction::kInvalidFeatureId = numeric_limits<uint32_t>::max(); bool Restriction::IsValid() const { return !m_featureIds.empty() && find(begin(m_featureIds), end(m_featureIds), kInvalidFeatureId) == end(m_featureIds); } bool Restriction::operator==(Restriction const & restriction) const { return m_featureIds == restriction.m_featureIds && m_type == restriction.m_type; } bool Restriction::operator<(Restriction const & restriction) const { if (m_type != restriction.m_type) return m_type < restriction.m_type; return m_featureIds < restriction.m_featureIds; } string ToString(Restriction::Type const & type) { switch (type) { case Restriction::Type::No: return kNo; case Restriction::Type::Only: return kOnly; } return "Unknown"; } string DebugPrint(Restriction::Type const & type) { return ToString(type); } string DebugPrint(Restriction const & restriction) { ostringstream out; out << "m_featureIds:[" << ::DebugPrint(restriction.m_featureIds) << "] m_type:" << DebugPrint(restriction.m_type) << " "; return out.str(); } } // namespace routing