| 398 | } |
| 399 | |
| 400 | TOPPASEdge::EdgeStatus TOPPASEdge::getListToolStatus_(TOPPASInputFileListVertex* source_input_list, TOPPASToolVertex* target_tool, int target_param_index) |
| 401 | { |
| 402 | QVector<TOPPASToolVertex::IOInfo> target_input_files; |
| 403 | target_tool->getInputParameters(target_input_files); |
| 404 | if (target_param_index >= target_input_files.size()) |
| 405 | { |
| 406 | return ES_TOOL_API_CHANGED; |
| 407 | } |
| 408 | |
| 409 | const QStringList& file_names = source_input_list->getFileNames(); |
| 410 | if (file_names.empty()) |
| 411 | { |
| 412 | // file names are not specified yet |
| 413 | return ES_NOT_READY_YET; |
| 414 | } |
| 415 | |
| 416 | if (target_param_index < 0) |
| 417 | { |
| 418 | return ES_NO_TARGET_PARAM; |
| 419 | } |
| 420 | |
| 421 | const TOPPASToolVertex::IOInfo& target_param = target_input_files[target_param_index]; |
| 422 | StringList target_param_types = target_param.valid_types; |
| 423 | |
| 424 | if (target_param_types.empty()) |
| 425 | { |
| 426 | // no file types specified --> allow |
| 427 | return ES_VALID; |
| 428 | } |
| 429 | |
| 430 | // check file type compatibility |
| 431 | foreach(const QString& q_file_name, file_names) |
| 432 | { |
| 433 | bool type_mismatch = true; |
| 434 | const String& file_name = String(q_file_name); |
| 435 | String::SizeType extension_start_index = file_name.rfind("."); |
| 436 | if (extension_start_index != String::npos) |
| 437 | { |
| 438 | String extension = file_name.substr(extension_start_index + 1); |
| 439 | extension.toLower(); |
| 440 | for (StringList::iterator it = target_param_types.begin(); it != target_param_types.end(); ++it) |
| 441 | { |
| 442 | String other_ext = *it; |
| 443 | other_ext.toLower(); |
| 444 | if (extension == other_ext || extension == "gz" || extension == "bz2") |
| 445 | { |
| 446 | type_mismatch = false; |
| 447 | break; |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | if (type_mismatch) |
| 453 | { |
| 454 | return ES_FILE_EXT_MISMATCH; |
| 455 | } |
| 456 | } |
| 457 |
nothing calls this directly
no test coverage detected