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

Function GetInt

CPP/Utils/ClipFileSave.cpp:228–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228static bool GetInt(string::const_iterator& s_it,
229 const string::const_iterator& it_end, int64_t& value)
230{
231 value = 0;
232 while (s_it != it_end && *s_it == ' ') ++s_it;
233 if (s_it == it_end) return false;
234 bool is_neg = (*s_it == '-');
235 if (is_neg) ++s_it;
236 string::const_iterator s_it2 = s_it;
237 while (s_it != it_end && *s_it >= '0' && *s_it <= '9')
238 {
239 value = value * 10 + static_cast<int64_t>(*s_it++) - 48;
240 }
241 if (s_it == s_it2) return false; //no value
242 //trim trailing space and a comma if present
243 while (s_it != it_end && *s_it == ' ') ++s_it;
244 if (s_it != it_end && *s_it == ',') ++s_it;
245 if (is_neg) value = -value;
246 return true;
247}
248
249bool SaveTest(const std::string& filename, bool append,
250 const Paths64* subj, const Paths64* subj_open, const Paths64* clip,

Callers 1

SaveTestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected