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

Method GetLocalFileName

Modules/Core/src/IO/mitkAbstractFileReader.cpp:226–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224 void AbstractFileReader::SetRanking(int ranking) { d->SetRanking(ranking); }
225 int AbstractFileReader::GetRanking() const { return d->GetRanking(); }
226 std::string AbstractFileReader::GetLocalFileName() const
227 {
228 std::string localFileName;
229 if (d->m_Stream)
230 {
231 if (d->m_TmpFile.empty())
232 {
233 // write the stream contents to temporary file
234 std::string ext = Utf8Util::Utf8ToLocal8Bit(itksys::SystemTools::GetFilenameExtension(Utf8Util::Local8BitToUtf8(this->GetInputLocation())));
235 std::ofstream tmpStream;
236 localFileName = mitk::IOUtil::CreateTemporaryFile(
237 tmpStream, std::ios_base::out | std::ios_base::trunc | std::ios_base::binary, "XXXXXX" + ext);
238 tmpStream << d->m_Stream->rdbuf();
239 d->m_TmpFile = localFileName;
240 }
241 else
242 {
243 localFileName = d->m_TmpFile;
244 }
245 }
246 else
247 {
248 localFileName = d->m_Location;
249 }
250 return localFileName;
251 }
252
253 //////////////////////// Options ///////////////////////
254

Callers 15

DoReadMethod · 0.80
GetConfidenceLevelMethod · 0.80
DoReadMethod · 0.80
DoReadMethod · 0.80
GetConfidenceLevelMethod · 0.80
DoReadMethod · 0.80
DoReadMethod · 0.80
WriteMethod · 0.80
DoReadMethod · 0.80

Calls 2

GetInputLocationMethod · 0.95
emptyMethod · 0.45

Tested by

no test coverage detected