| 24 | |
| 25 | template <typename T> |
| 26 | T GetCommonProperty(const mdf::detail::Hd4Block& block, |
| 27 | const std::string& key) { |
| 28 | const auto* md4 = block.Md4(); |
| 29 | if (md4 == nullptr || md4->IsTxtBlock()) { |
| 30 | return {}; |
| 31 | } |
| 32 | auto xml_file = mdf::CreateXmlFile("Expat"); |
| 33 | xml_file->ParseString(md4->Text()); |
| 34 | const auto* common = xml_file->GetNode("common_properties"); |
| 35 | if (common == nullptr) { |
| 36 | return {}; |
| 37 | } |
| 38 | const auto* key_node = common->GetNode("e", "name", key); |
| 39 | return key_node == nullptr ? T{} : key_node->Value<T>(); |
| 40 | } |
| 41 | |
| 42 | template <typename T> |
| 43 | void SetCommonProperty(mdf::detail::Hd4Block& block, const std::string& key, |
no test coverage detected