MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / ToXml

Method ToXml

lib/mdflib/mdflib/src/fhcomment.cpp:57–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57std::string FhComment::ToXml() const {
58 try {
59 auto xml_file = CreateXmlFile("FileWriter");
60 constexpr bool ho_active = false;
61 auto& root_node = CreateRootNode(*xml_file, ho_active);
62 ToTx(root_node);
63 if (tool_id_.IsActive()) {
64 tool_id_.ToXml(root_node, "tool_id");
65 }
66 if (tool_vendor_.IsActive()) {
67 tool_vendor_.ToXml(root_node, "tool_vendor");
68 }
69 if (tool_version_.IsActive()) {
70 tool_version_.ToXml(root_node, "tool_version");
71 }
72 if (user_name_.IsActive()) {
73 user_name_.ToXml(root_node, "user_name");
74 }
75 ToCommonProp(root_node);
76 return xml_file->WriteString(true);
77 } catch (const std::exception& err) {
78 MDF_ERROR() << "Failed to create the EV comment. Error: " << err.what();
79 }
80 return {};
81}
82
83void FhComment::FromXml(const std::string& xml_snippet) {
84 if (xml_snippet.empty()) {

Callers

nothing calls this directly

Calls 3

CreateXmlFileFunction · 0.85
WriteStringMethod · 0.80
IsActiveMethod · 0.45

Tested by

no test coverage detected