blob: a9efc8d6f38ce9efbf502cc14ca907e298d85fc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "routing/restrictions_serialization.hpp"
#include "std/sstream.hpp"
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
|