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

Method GetBlockProperty

lib/mdflib/mdflib/src/at4block.cpp:105–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103At4Block::At4Block() { block_type_ = "##AT"; }
104
105void At4Block::GetBlockProperty(BlockPropertyList& dest) const {
106 MdfBlock::GetBlockProperty(dest);
107
108 dest.emplace_back("Links", "", "", BlockItemType::HeaderItem);
109 dest.emplace_back("Next AT", ToHexString(Link(kIndexNext)),
110 "Link to next attach", BlockItemType::LinkItem);
111 dest.emplace_back("File Name TX", ToHexString(Link(kIndexFilename)),
112 filename_, BlockItemType::LinkItem);
113 dest.emplace_back("Mime Type TX", ToHexString(Link(kIndexType)), file_type_,
114 BlockItemType::LinkItem);
115 dest.emplace_back("Comment MD", ToHexString(Link(kIndexMd)), Comment(),
116 BlockItemType::LinkItem);
117 dest.emplace_back("", "", "", BlockItemType::BlankItem);
118
119 dest.emplace_back("Information", "", "", BlockItemType::HeaderItem);
120 std::string name;
121 if (Link(kIndexFilename) > 0) {
122 try {
123 fs::path p = fs::u8path(filename_);
124 const auto& u8str = p.filename().u8string();
125 name = std::string(u8str.begin(), u8str.end());
126 } catch (const std::exception&) {
127 name = "<invalid>";
128 }
129 dest.emplace_back("File Name", name, name == filename_ ? "" : filename_);
130 }
131 if (Link(kIndexType) > 0) {
132 dest.emplace_back("File Type", file_type_);
133 }
134 dest.emplace_back("Flags", MakeFlagString(flags_));
135 dest.emplace_back("Creator Index", std::to_string(creator_index_));
136 if (flags_ & At4Flags::kUsingMd5) {
137 dest.emplace_back("MD5 Checksum", ToMd5String(md5_));
138 }
139 dest.emplace_back("Original Size [byte]", std::to_string(original_size_));
140 dest.emplace_back("Embedded Size [byte]", std::to_string(nof_bytes_));
141 if (md_comment_) {
142 md_comment_->GetBlockProperty(dest);
143 }
144}
145
146uint64_t At4Block::Read(std::streambuf& buffer) {
147 uint64_t bytes = ReadHeader4(buffer);

Callers

nothing calls this directly

Calls 5

ToHexStringFunction · 0.85
ToMd5StringFunction · 0.85
beginMethod · 0.80
MakeFlagStringFunction · 0.70
filenameMethod · 0.45

Tested by

no test coverage detected