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

Method ToXml

lib/mdflib/mdflib/src/evcomment.cpp:48–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48std::string EvComment::ToXml() const {
49 try {
50 auto xml_file = CreateXmlFile("FileWriter");
51 constexpr bool ho_active = false;
52 auto& root_node = CreateRootNode(*xml_file, ho_active);
53 ToTx(root_node);
54 if (pre_trigger_interval_.IsActive()) {
55 pre_trigger_interval_.ToXml(root_node, "pre_trigger_interval");
56 }
57 if (post_trigger_interval_.IsActive()) {
58 post_trigger_interval_.ToXml(root_node, "post_trigger_interval");
59 }
60 ToFormula(root_node);
61 if (timeout_.IsActive()) {
62 timeout_.ToXml(root_node, "timeout");
63 }
64 ToCommonProp(root_node);
65 return xml_file->WriteString(true);
66 } catch (const std::exception& err) {
67 MDF_ERROR() << "Failed to create the EV comment. Error: " << err.what();
68 }
69 return {};
70}
71
72void EvComment::FromXml(const std::string& xml_snippet) {
73 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