| 47 | } |
| 48 | |
| 49 | std::string CcUnit::ToXml() const { |
| 50 | try { |
| 51 | auto xml_file = CreateXmlFile("FileWriter"); |
| 52 | constexpr bool ho_active = false; |
| 53 | auto& root_node = CreateRootNode(*xml_file, ho_active); |
| 54 | MdComment::ToXml(root_node); |
| 55 | if (unit_ref_.IsActive()) { |
| 56 | auto& unit_ref_node = root_node.AddNode("ho_unit"); |
| 57 | unit_ref_.MdStandardAttribute::ToXml(unit_ref_node); |
| 58 | unit_ref_node.SetAttribute("unit_ref", unit_ref_.Text()); |
| 59 | } |
| 60 | return xml_file->WriteString(true); |
| 61 | } catch (const std::exception& err) { |
| 62 | MDF_ERROR() << "Failed to create the CC unit. Error: " << err.what(); |
| 63 | } |
| 64 | return {}; |
| 65 | } |
| 66 | |
| 67 | void CcUnit::FromXml(const std::string& xml_snippet) { |
| 68 | if (xml_snippet.empty()) { |
nothing calls this directly
no test coverage detected