| 19 | }; |
| 20 | |
| 21 | static 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 | |
| 46 | static bool parse_box(const std::string & field, sam3_box & box) { |
| 47 | if (field.empty()) { |