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

Function GetCommonProperty

lib/mdflib/mdflib/src/hd4block.cpp:26–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25template <typename T>
26T GetCommonProperty(const mdf::detail::Hd4Block& block,
27 const std::string& key) {
28 const auto* md4 = block.Md4();
29 if (md4 == nullptr || md4->IsTxtBlock()) {
30 return {};
31 }
32 auto xml_file = mdf::CreateXmlFile("Expat");
33 xml_file->ParseString(md4->Text());
34 const auto* common = xml_file->GetNode("common_properties");
35 if (common == nullptr) {
36 return {};
37 }
38 const auto* key_node = common->GetNode("e", "name", key);
39 return key_node == nullptr ? T{} : key_node->Value<T>();
40}
41
42template <typename T>
43void SetCommonProperty(mdf::detail::Hd4Block& block, const std::string& key,

Callers 2

MdfMetaData.hFile · 0.85
MdfMetaData.cppFile · 0.85

Calls 6

CreateXmlFileFunction · 0.85
Md4Method · 0.80
IsTxtBlockMethod · 0.80
ParseStringMethod · 0.45
TextMethod · 0.45
GetNodeMethod · 0.45

Tested by

no test coverage detected