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

Function MakePhysicalDimension

lib/mdflib/mdflib/src/md4block.cpp:27–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void MakePhysicalDimension(const mdf::IXmlNode &pd,
28 mdf::detail::BlockPropertyList &dest) {
29 mdf::IXmlNode::ChildList list;
30 pd.GetChildList(list);
31
32 const auto name = pd.Attribute<std::string>("ID");
33
34 std::string label;
35 std::ostringstream desc;
36 for (const auto &c : list) {
37 if (c->IsTagName("SHORT_NAME")) {
38 label = c->Value<std::string>();
39 } else if (c->IsTagName("DESC")) {
40 const auto lang = c->Attribute<std::string>("xml:lang");
41 const auto d = c->Value<std::string>();
42 if (lang.empty()) {
43 if (desc.str().empty()) {
44 desc << d;
45 } else {
46 desc << ", " << d;
47 }
48 } else {
49 if (desc.str().empty()) {
50 desc << lang << ":" << d;
51 } else {
52 desc << ", " << lang << ":" << d;
53 }
54 }
55 }
56 }
57 dest.emplace_back(label, name, desc.str());
58}
59
60void MakePhysicalDimensionList(const mdf::IXmlNode &root,
61 mdf::detail::BlockPropertyList &dest) {

Callers 1

Calls 3

IsTagNameMethod · 0.80
emptyMethod · 0.80
GetChildListMethod · 0.45

Tested by

no test coverage detected