| 33 | } |
| 34 | |
| 35 | std::string extract_header_block(const std::string& text) { |
| 36 | const std::size_t header_pos = text.find("<PP_HEADER"); |
| 37 | if (header_pos == std::string::npos) { |
| 38 | throw std::runtime_error("parse_upf_minimal: missing <PP_HEADER> tag"); |
| 39 | } |
| 40 | const std::size_t header_end = text.find('>', header_pos); |
| 41 | if (header_end == std::string::npos) { |
| 42 | throw std::runtime_error("parse_upf_minimal: malformed <PP_HEADER> tag"); |
| 43 | } |
| 44 | return text.substr(header_pos, header_end - header_pos + 1); |
| 45 | } |
| 46 | |
| 47 | std::string extract_attribute(const std::string& header, const std::string& name) { |
| 48 | const std::string needle = name + "=\""; |