Log connection state transitions.
[yandex-traffic] / regions.cpp
1 #include <QtCore>
2
3 #include "regions.hpp"
4
5
6 RegionsTable::RegionsTable ()
7 {
8     // Load saved table, if failed, initialize default table of regions
9     makeDefaultTable ();
10 }
11
12
13 void RegionsTable::makeDefaultTable ()
14 {
15     _map.clear ();
16     _map.insert ("1", RegionInfo ("1", "Moscow"));
17     _map.insert ("10174", RegionInfo ("10174", "St. Petersburg"));
18     _map.insert ("20544", RegionInfo ("20544", "Kiev"));
19     _map.insert ("11162", RegionInfo ("11162", "Ekaterinburg"));
20 }
21
22
23 const RegionInfo *RegionsTable::lookup (const QString &id) const
24 {
25     QMap<QString, RegionInfo>::const_iterator it = _map.find (id);
26
27     if (it == _map.end ())
28         return NULL;
29     else
30         return &*it;
31 }