MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / GetCOMPluginInfo

Method GetCOMPluginInfo

PathCopyCopy/src/PathCopyCopySettings.cpp:984–1022  ·  view source on GitHub ↗

Returns the info to write in the value for a registered COM plugin. This info is no longer used by the UI, but left for backward-compatibility purposes in case plugins depend on it. @param p_CLSID ID of the plugin COM class. @return Info string.

Source from the content-addressed store, hash-verified

982 // @return Info string.
983 //
984 std::wstring Settings::GetCOMPluginInfo(const CLSID& p_CLSID)
985 {
986 // The format is:
987 //
988 // <group_id>,<group_pos>|<description>
989 //
990 // If the plugin doesn't support group info, that will amount to
991 //
992 // |<description>
993 //
994 // Note that the UI now uses the COMPluginExecutor to fetch this
995 // information; however we'll keep writing it for backward-compatibility.
996
997 std::wostringstream wos;
998
999 ATL::CComPtr<IPathCopyCopyPlugin> cpPlugin;
1000 if (SUCCEEDED(cpPlugin.CoCreateInstance(p_CLSID)) && cpPlugin.p != nullptr) {
1001 // First check for group info.
1002 ATL::CComQIPtr<IPathCopyCopyPluginGroupInfo> cpPluginGI(cpPlugin);
1003 if (cpPluginGI.p != nullptr) {
1004 ULONG groupId = 0, groupPos = 0;
1005 if (SUCCEEDED(cpPluginGI->get_GroupId(&groupId)) &&
1006 SUCCEEDED(cpPluginGI->get_GroupPosition(&groupPos))) {
1007
1008 wos << groupId << INFO_GROUP_INFO_SEPARATOR << groupPos;
1009 }
1010 }
1011
1012 // Now include description.
1013 ATL::CComBSTR bstrDesc;
1014 wos << INFO_DESCRIPTION_SEPARATOR;
1015 if (SUCCEEDED(cpPlugin->get_Description(&bstrDesc)) && bstrDesc.m_str != nullptr) {
1016 wos << bstrDesc.m_str;
1017 }
1018 }
1019
1020 std::wstring s = wos.str();
1021 return s;
1022 }
1023
1024 //
1025 // Static method that returns the list of COM plugins registered in

Callers

nothing calls this directly

Calls 3

get_GroupIdMethod · 0.45
get_GroupPositionMethod · 0.45
get_DescriptionMethod · 0.45

Tested by

no test coverage detected