MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / getFileFormatFilter

Method getFileFormatFilter

qCC/ccCommandLineCommands.cpp:308–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306{}
307
308QString CommandChangeOutputFormat::getFileFormatFilter(ccCommandLineInterface& cmd, QString& defaultExt)
309{
310 QString fileFilter;
311 defaultExt.clear();
312
313 if (!cmd.arguments().isEmpty())
314 {
315 //test if the specified format corresponds to a known file type
316 QString extension = cmd.arguments().front().toUpper();
317 cmd.arguments().pop_front();
318
319 const FileIOFilter::FilterContainer& filters = FileIOFilter::GetFilters();
320
321 for (const auto & filter : filters)
322 {
323 if (extension == filter->getDefaultExtension().toUpper())
324 {
325 //found a matching filter
326 fileFilter = filter->getFileFilters(false).first();
327 defaultExt = filter->getDefaultExtension();
328 break;
329 }
330 }
331
332 //haven't found anything?
333 if (fileFilter.isEmpty())
334 {
335 cmd.error(QObject::tr("Unhandled format specifier (%1)").arg(extension));
336 }
337 }
338 else
339 {
340 cmd.error(QObject::tr("Missing file format specifier!"));
341 }
342
343 return fileFilter;
344}
345
346CommandChangeCloudOutputFormat::CommandChangeCloudOutputFormat()
347 : CommandChangeOutputFormat(QObject::tr("Change cloud output format"), COMMAND_CLOUD_EXPORT_FORMAT)

Callers

nothing calls this directly

Calls 4

getDefaultExtensionMethod · 0.80
errorMethod · 0.80
clearMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected