MCPcopy Create free account
hub / github.com/WinMerge/winmerge / GetEditorScriptPlugin

Method GetEditorScriptPlugin

Src/FileTransform.cpp:851–885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849// transformation text
850
851bool EditorScriptInfo::GetEditorScriptPlugin(std::vector<std::tuple<PluginInfo*, uint8_t, std::vector<String>, int>>& plugins,
852 String& errorMessage) const
853{
854 auto result = ExpandAliases(this->m_PluginPipeline, _T(""), L"ALIAS_EDITOR_SCRIPT", errorMessage);
855 if (!errorMessage.empty())
856 return false;
857 for (auto& [pluginName, targetFlags, args, quoteChar] : result)
858 {
859 bool found = false;
860 PluginArray *pluginInfoArray = CAllThreadsScripts::GetActiveSet()->GetAvailableScripts(L"EDITOR_SCRIPT");
861 for (const auto& plugin : *pluginInfoArray)
862 {
863 std::vector<String> namesArray;
864 std::vector<int> idArray;
865 int nFunc = plugin::GetMethodsFromScript(plugin->m_lpDispatch, namesArray, idArray);
866 for (int i = 0; i < nFunc; ++i)
867 {
868 if (namesArray[i] == pluginName)
869 {
870 plugins.push_back({ plugin.get(), targetFlags, args, idArray[i]});
871 found = true;
872 break;
873 }
874 }
875 if (found)
876 break;
877 }
878 if (!found)
879 {
880 errorMessage = strutils::format_string1(_("Plugin not found or invalid: %1"), pluginName);
881 return false;
882 }
883 }
884 return true;
885}
886
887bool EditorScriptInfo::TransformText(int target, String& text, const std::vector<StringView>& variables, bool& changed)
888{

Callers

nothing calls this directly

Calls 6

ExpandAliasesFunction · 0.85
GetMethodsFromScriptFunction · 0.85
GetAvailableScriptsMethod · 0.80
format_string1Function · 0.50
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected