| 21 | using StringPtrT = char const *; |
| 22 | |
| 23 | void AddAttr(StringPtrT k, StringPtrT value) |
| 24 | { |
| 25 | if (!m_current) |
| 26 | return; |
| 27 | |
| 28 | std::string_view key(k); |
| 29 | |
| 30 | if (key == "id") |
| 31 | CHECK(strings::to_uint64(value, m_current->m_id), ("Unknown element with invalid id:", value)); |
| 32 | else if (key == "lon") |
| 33 | CHECK(strings::to_double(value, m_current->m_lon), ("Bad node lon:", value)); |
| 34 | else if (key == "lat") |
| 35 | CHECK(strings::to_double(value, m_current->m_lat), ("Bad node lat:", value)); |
| 36 | else if (key == "ref") |
| 37 | CHECK(strings::to_uint64(value, m_current->m_ref), ("Bad node ref in way:", value)); |
| 38 | else if (key == "k") |
| 39 | m_current->m_k = value; |
| 40 | else if (key == "v") |
| 41 | m_current->m_v = value; |
| 42 | else if (key == "type") |
| 43 | m_current->m_memberType = OsmElement::StringToEntityType(value); |
| 44 | else if (key == "role") |
| 45 | m_current->m_role = value; |
| 46 | } |
| 47 | |
| 48 | bool Push(StringPtrT tagName) |
| 49 | { |