| 25 | }; |
| 26 | |
| 27 | static 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 | |
| 55 | static bool parse_box(const std::string & field, sam3_box & box) { |
| 56 | if (field.empty()) { |
no outgoing calls
no test coverage detected