MCPcopy Create free account
hub / github.com/comaps/comaps / GetPopulation

Function GetPopulation

generator/osm_element_helpers.cpp:10–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace osm_element
9{
10uint64_t GetPopulation(std::string const & str)
11{
12 std::string number;
13 for (auto const c : str)
14 if (isdigit(c))
15 number += c;
16 else if (c == '.' || c == ',' || c == ' ')
17 continue;
18 else
19 break;
20
21 if (number.empty())
22 return 0;
23
24 uint64_t result = 0;
25 if (!strings::to_uint64(number, result))
26 LOG(LWARNING, ("Failed to get population from", number, str));
27
28 return result;
29}
30
31uint64_t GetPopulation(OsmElement const & elem)
32{

Callers 4

GetNameAndTypeFunction · 0.70
LocalityMethod · 0.70
UNIT_TESTFunction · 0.50
ParseAllMethod · 0.50

Calls 3

to_uint64Function · 0.85
GetTagMethod · 0.80
emptyMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.40