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

Method PluginIdsToString

PathCopyCopy/src/PluginUtils.cpp:542–563  ·  view source on GitHub ↗

Converts a list of plugin IDs to a string containing them. This is the opposite of StringToPluginIds. @param p_vPluginIds List of plugin IDs to convert. @param p_Separator Character used to separate the plugin IDs in the string. @return String with merged plugin IDs.

Source from the content-addressed store, hash-verified

540 // @return String with merged plugin IDs.
541 //
542 std::wstring PluginUtils::PluginIdsToString(const GUIDV& p_vPluginIds,
543 const wchar_t p_Separator)
544 {
545 std::wstring guidBuffer(40, L'\0'); // See StringFromGUID2 in MSDN
546 const auto guidToString = [&](const GUID& p_GUID) -> std::wstring {
547 return (::StringFromGUID2(p_GUID, &*guidBuffer.begin(), 40) != 0) ? guidBuffer.c_str() : L"";
548 };
549
550 // Insert the first plugin ID without separator.
551 std::wostringstream wos;
552 if (!p_vPluginIds.empty()) {
553 wos << guidToString(p_vPluginIds.front());
554
555 // Insert the other elements with separators.
556 for (auto it = p_vPluginIds.cbegin() + 1; it != p_vPluginIds.cend(); ++it) {
557 wos << p_Separator << guidToString(*it);
558 }
559 }
560
561 // Return resulting string.
562 return wos.str();
563 }
564
565 //
566 // Converts a list of unsigned integers to a string containing them.

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.80
beginMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected