MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / GetInt

Function GetInt

CPP/Utils/ClipFileLoad.cpp:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9using namespace Clipper2Lib;
10
11bool GetInt(string::const_iterator& s_it,
12 const string::const_iterator& it_end, int64_t& value)
13{
14 value = 0;
15 while (s_it != it_end && *s_it == ' ') ++s_it;
16 if (s_it == it_end) return false;
17 bool is_neg = (*s_it == '-');
18 if (is_neg) ++s_it;
19 string::const_iterator s_it2 = s_it;
20 while (s_it != it_end && *s_it >= '0' && *s_it <= '9')
21 {
22 value = value * 10 + static_cast<int64_t>(*s_it++) - 48;
23 }
24
25 if (s_it == s_it2) return false; //no value
26 //trim trailing space and a comma if present
27 while (s_it != it_end && *s_it == ' ') ++s_it;
28 if (s_it != it_end && *s_it == ',') ++s_it;
29 if (is_neg) value = -value;
30 return true;
31}
32
33bool GetPath(const string& line, Paths64& paths)
34{

Callers 2

GetPathFunction · 0.70
LoadTestNumFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected