| 674 | // transformation prediffing |
| 675 | |
| 676 | bool PrediffingInfo::GetPrediffPlugin(const String& filteredFilenames, bool bReverse, |
| 677 | std::vector<std::tuple<PluginInfo*, uint8_t, std::vector<String>, bool>>& plugins, |
| 678 | String *pPluginPipelineResolved, String& errorMessage) const |
| 679 | { |
| 680 | auto result = ExpandAliases(this->m_PluginPipeline, filteredFilenames, L"ALIAS_PREDIFF", errorMessage); |
| 681 | if (!errorMessage.empty()) |
| 682 | return false; |
| 683 | std::vector<PluginForFile::PipelineItem> pipelineResolved; |
| 684 | for (auto& [pluginName, targetFlags, args, quoteChar] : result) |
| 685 | { |
| 686 | PluginInfo* plugin = nullptr; |
| 687 | if (pluginName == _T("<None>") || pluginName == _("<None>")) |
| 688 | ; |
| 689 | else if (pluginName == _T("<Automatic>") || pluginName == _("<Automatic>")) |
| 690 | { |
| 691 | const auto filenames = strutils::split(filteredFilenames, '|'); |
| 692 | std::vector<std::pair<PluginInfo*, bool>> pluginInfos; |
| 693 | for (int i = 0; i < filenames.size(); ++i) |
| 694 | { |
| 695 | bool bWithFile = true; |
| 696 | const String filename{ filenames[i].data(), filenames[i].size() }; |
| 697 | plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_PREDIFF", filename); |
| 698 | if (plugin == nullptr) |
| 699 | { |
| 700 | plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"BUFFER_PREDIFF", filename); |
| 701 | if (plugin) |
| 702 | bWithFile = false; |
| 703 | } |
| 704 | pluginInfos.push_back({ plugin, bWithFile }); |
| 705 | } |
| 706 | if (!filenames.empty() && |
| 707 | std::all_of(pluginInfos.begin() + 1, pluginInfos.end(), |
| 708 | [&](const auto& elem) { return elem == pluginInfos.front(); })) |
| 709 | { |
| 710 | const auto& pluginInfo = pluginInfos.front(); |
| 711 | if (pluginInfo.first) |
| 712 | { |
| 713 | pipelineResolved.push_back({ pluginInfo.first->m_name, targetFlags, args, quoteChar }); |
| 714 | plugins.insert(bReverse ? plugins.begin() : plugins.end(), |
| 715 | { pluginInfo.first, targetFlags, args, pluginInfo.second }); |
| 716 | } |
| 717 | } |
| 718 | else |
| 719 | { |
| 720 | for (int i = 0; i < pluginInfos.size(); ++i) |
| 721 | { |
| 722 | const auto& pluginInfo = pluginInfos[i]; |
| 723 | if (isTargetInFlags(i, targetFlags) && pluginInfo.first) |
| 724 | { |
| 725 | uint8_t targetFlags2 = 1 << i; |
| 726 | pipelineResolved.push_back({ pluginInfo.first->m_name, targetFlags2, args, quoteChar }); |
| 727 | plugins.insert(bReverse ? plugins.begin() : plugins.end(), |
| 728 | { pluginInfo.first, targetFlags2, args, pluginInfo.second }); |
| 729 | } |
| 730 | } |
| 731 | } |
| 732 | } |
| 733 | else |
nothing calls this directly
no test coverage detected