MCPcopy Create free account
hub / github.com/MITK/MITK / GetParentPath

Function GetParentPath

Plugins/org.mitk.gui.qt.application/src/QmitkFileSaveAction.cpp:42–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 }
41
42 QString GetParentPath(mitk::DataNode::Pointer dataNode)
43 {
44 if (dataNode.IsNull())
45 return "";
46
47 auto dataStorage = GetDataStorage();
48
49 if (dataStorage.IsNull())
50 return "";
51
52 auto sources = dataStorage->GetSources(dataNode);
53
54 if (sources.IsNull() || sources->empty())
55 return "";
56
57 const auto &parentNode = sources->front();
58
59 if (parentNode.IsNull())
60 return "";
61
62 auto data = parentNode->GetData();
63
64 if (nullptr != data)
65 {
66 auto pathProperty = data->GetConstProperty("path");
67
68 if (pathProperty.IsNotNull())
69 return QFileInfo(QString::fromStdString(pathProperty->GetValueAsString())).canonicalPath();
70 }
71
72 return GetParentPath(parentNode);
73 }
74}
75
76class QmitkFileSaveActionPrivate

Callers 1

RunMethod · 0.85

Calls 9

GetSourcesMethod · 0.80
frontMethod · 0.80
IsNotNullMethod · 0.80
GetDataStorageFunction · 0.70
IsNullMethod · 0.45
emptyMethod · 0.45
GetDataMethod · 0.45
GetConstPropertyMethod · 0.45
GetValueAsStringMethod · 0.45

Tested by

no test coverage detected