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

Method GetBlockProperty

lib/mdflib/mdflib/src/md4block.cpp:301–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301void Md4Block::GetBlockProperty(BlockPropertyList &dest) const {
302 // If it is a plain text box
303 if (IsTxtBlock()) {
304 return Tx4Block::GetBlockProperty(dest);
305 }
306 // Parse out the XML data
307 auto xml = CreateXmlFile();
308 const bool parse = xml->ParseString(Text());
309 if (!parse) {
310 return Tx4Block::GetBlockProperty(dest);
311 }
312
313 // Check if the XML only include a TX tag. Then its treated as a normal text
314 // block.
315 IXmlNode::ChildList root_list;
316 xml->GetChildList(root_list);
317 if (root_list.size() <= 1) {
318 if (!TxComment().empty()) {
319 dest.emplace_back("Comment", TxComment());
320 }
321 return;
322 }
323
324 // Time to present the metadata items. Note that the HD block is the main
325 // (only) holder of metadata
326 dest.emplace_back("", "", "", BlockItemType::BlankItem);
327
328 // Present as META data
329 dest.emplace_back("Meta Data", "", "", BlockItemType::HeaderItem);
330
331 const auto comment = xml->Property<std::string>("TX");
332 if (!comment.empty()) {
333 dest.emplace_back("Comment", comment);
334 }
335
336 const auto time_source = xml->Property<std::string>("time_source");
337 if (!time_source.empty()) {
338 dest.emplace_back("Time Source", time_source);
339 }
340
341 const auto tool_id = xml->Property<std::string>("tool_id");
342 if (!tool_id.empty()) {
343 dest.emplace_back("Tool ID", tool_id);
344 }
345
346 const auto tool_vendor = xml->Property<std::string>("tool_vendor");
347 if (!tool_vendor.empty()) {
348 dest.emplace_back("Tool Vendor", tool_vendor);
349 }
350
351 const auto tool_version = xml->Property<std::string>("tool_version");
352 if (!tool_version.empty()) {
353 dest.emplace_back("Tool Version", tool_version);
354 }
355
356 const auto user_name = xml->Property<std::string>("user_name");
357 if (!user_name.empty()) {
358 dest.emplace_back("User Name", user_name);

Callers

nothing calls this directly

Calls 11

CreateXmlFileFunction · 0.85
MakeCommonPropertyListFunction · 0.85
MakeConstantListFunction · 0.85
MakeUnitSpecListFunction · 0.85
emptyMethod · 0.80
TagNameMethod · 0.80
ParseStringMethod · 0.45
GetChildListMethod · 0.45
sizeMethod · 0.45
GetNodeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected