| 90 | } |
| 91 | |
| 92 | std::string CnComment::ToXml() const { |
| 93 | try { |
| 94 | auto xml_file = CreateXmlFile("FileWriter"); |
| 95 | constexpr bool ho_active = false; |
| 96 | auto& root_node = CreateRootNode(*xml_file, ho_active); |
| 97 | ToTx(root_node); |
| 98 | ToNames(root_node); |
| 99 | if (linker_name_.IsActive()) { |
| 100 | linker_name_.ToXml(root_node, "linker_name"); |
| 101 | } |
| 102 | if (linker_address_.IsActive()) { |
| 103 | linker_address_.ToXml(root_node, "linker_address"); |
| 104 | } |
| 105 | if (axis_monotony_.has_value()) { |
| 106 | root_node.SetProperty("axis_monotony", |
| 107 | MdMonotonyToString(axis_monotony_.value())); |
| 108 | } |
| 109 | if (raster_.IsActive()) { |
| 110 | raster_.ToXml(root_node, "raster"); |
| 111 | } |
| 112 | ToFormula(root_node); |
| 113 | |
| 114 | if (address_.IsActive()) { |
| 115 | address_.ToXml(root_node, "address"); |
| 116 | } |
| 117 | ToCommonProp(root_node); |
| 118 | return xml_file->WriteString(true); |
| 119 | } catch (const std::exception& err) { |
| 120 | MDF_ERROR() << "Failed to create the CN comment. Error: " << err.what(); |
| 121 | } |
| 122 | return {}; |
| 123 | } |
| 124 | |
| 125 | void CnComment::FromXml(const std::string& xml_snippet) { |
| 126 | if (xml_snippet.empty()) { |
nothing calls this directly
no test coverage detected