Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.hpp « storage - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8892ee51aeb27387f74263eea030709599e01ecc (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
#pragma once
#include "std/string.hpp"


namespace storage
{
  struct TIndex
  {
    static int const INVALID;

    int m_group;
    int m_country;
    int m_region;

    TIndex(int group = INVALID, int country = INVALID, int region = INVALID)
      : m_group(group), m_country(country), m_region(region) {}

    bool IsValid() const { return (m_group != INVALID && m_country != INVALID); }

    bool operator==(TIndex const & other) const
    {
      return (m_group == other.m_group &&
              m_country == other.m_country &&
              m_region == other.m_region);
    }
     
    bool operator!=(TIndex const & other) const
    {
      return !(*this == other);
    }

    bool operator<(TIndex const & other) const
    {
      if (m_group != other.m_group)
        return m_group < other.m_group;
      else if (m_country != other.m_country)
        return m_country < other.m_country;
      return m_region < other.m_region;
    }
  };

  string DebugPrint(TIndex const & r);
}