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

Method ToXml

lib/mdflib/mdflib/src/mdvariable.cpp:91–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void MdVariable::ToXml(IXmlNode& root_node, const std::string& tag_name) const {
92 IXmlNode& node = root_node.AddNode(tag_name);
93
94 if (!cn_.empty()) {
95 node.SetAttribute("cn", cn_);
96 }
97 if (!cs_.empty()) {
98 node.SetAttribute("cs", cs_);
99 }
100 if (!cp_.empty()) {
101 node.SetAttribute("cp", cp_);
102 }
103
104 if (!gn_.empty()) {
105 node.SetAttribute("gn", gn_);
106 }
107 if (!gs_.empty()) {
108 node.SetAttribute("gs", gs_);
109 }
110 if (!gp_.empty()) {
111 node.SetAttribute("gp", gp_);
112 }
113
114 if (!index_list_.empty()) {
115 std::ostringstream idx;
116 for (const uint64_t index : index_list_) {
117 if (!idx.str().empty()) {
118 idx << " ";
119 }
120 idx << index;
121 }
122 node.SetAttribute("idx_list_pattern", idx.str());
123 }
124
125 if (raw_) {
126 node.SetAttribute("raw", raw_);
127 }
128
129 MdStandardAttribute::ToXml(node);
130
131 node.Value(Variable());
132}
133
134void MdVariable::FromXml(const IXmlNode& var_node) {
135 MdString::FromXml(var_node);

Callers

nothing calls this directly

Calls 4

AddNodeMethod · 0.80
emptyMethod · 0.80
SetAttributeMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected