MCPcopy Create free account
hub / github.com/SZAILAB/MaterialDFT-Demo / extract_header_block

Function extract_header_block

cpp_core/src/pseudo_upf.cpp:35–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35std::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
47std::string extract_attribute(const std::string& header, const std::string& name) {
48 const std::string needle = name + "=\"";

Callers 1

parse_upf_minimalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected