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

Function parse_points

tests/test_metal_phase6.cpp:21–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19};
20
21static std::vector<sam3_point> parse_points(const std::string & field) {
22 std::vector<sam3_point> pts;
23 if (field.empty()) {
24 return pts;
25 }
26
27 size_t start = 0;
28 while (start < field.size()) {
29 size_t end = field.find('|', start);
30 if (end == std::string::npos) {
31 end = field.size();
32 }
33
34 const std::string part = field.substr(start, end - start);
35 const size_t colon = part.find(':');
36 if (colon != std::string::npos) {
37 pts.push_back({std::stof(part.substr(0, colon)), std::stof(part.substr(colon + 1))});
38 }
39
40 start = end + 1;
41 }
42
43 return pts;
44}
45
46static bool parse_box(const std::string & field, sam3_box & box) {
47 if (field.empty()) {

Callers 1

load_casesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected