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

Method GetBlock

lib/mdflib/mdfviewer/src/mdfdocument.cpp:186–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186mdf::detail::MdfBlock*MdfDocument::GetBlock(int64_t id) const {
187 const auto *file = GetFile();
188 if (file == nullptr || id < 0) {
189 return nullptr;
190 }
191
192 mdf::detail::MdfBlock* block = nullptr;
193 if (file->IsMdf4()) {
194 const auto *file4 = dynamic_cast<const mdf::detail::Mdf4File *>(file);
195 if (file4 != nullptr) {
196 block = file4->Find(id);
197 }
198 } else {
199 const auto *file3 = dynamic_cast<const mdf::detail::Mdf3File *>(file);
200 if (file3 != nullptr) {
201 block = file3->Find(id);
202 }
203 }
204 return block;
205}
206
207void MdfDocument::OnSaveAttachment(wxCommandEvent &) {
208 const auto id = GetSelectedBlockId();

Callers 1

RedrawListViewMethod · 0.80

Calls 2

IsMdf4Method · 0.45
FindMethod · 0.45

Tested by

no test coverage detected