MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / parse_points

Function parse_points

tests/test_phase6.cpp:27–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25};
26
27static std::vector<sam3_point> parse_points(const std::string & field) {
28 std::vector<sam3_point> pts;
29 if (field.empty()) {
30 return pts;
31 }
32
33 size_t start = 0;
34 while (start < field.size()) {
35 size_t end = field.find('|', start);
36 if (end == std::string::npos) {
37 end = field.size();
38 }
39
40 const std::string part = field.substr(start, end - start);
41 size_t colon = part.find(':');
42 if (colon != std::string::npos) {
43 sam3_point pt;
44 pt.x = std::stof(part.substr(0, colon));
45 pt.y = std::stof(part.substr(colon + 1));
46 pts.push_back(pt);
47 }
48
49 start = end + 1;
50 }
51
52 return pts;
53}
54
55static bool parse_box(const std::string & field, sam3_box & box) {
56 if (field.empty()) {

Callers 2

parse_phase6_caseFunction · 0.70
load_casesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected