MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / runConfigSearch

Method runConfigSearch

apps/tools/Studio/StudioApp.cpp:2748–2823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2746 }
2747 }
2748}
2749
2750void StudioApp::runConfigSearch()
2751{
2752 configSearchResults.clear();
2753 std::string q = configSearch;
2754 while (!q.empty() && q.front() == ' ')
2755 q.erase(0, 1);
2756 while (!q.empty() && q.back() == ' ')
2757 q.pop_back();
2758
2759 if (q.empty())
2760 {
2761 configSearchActive = false;
2762 return;
2763 }
2764 configSearchActive = true;
2765
2766 if (!configFile)
2767 return;
2768
2769 if (q.find(">>") != std::string::npos)
2770 {
2771 std::vector<std::string> parts;
2772 std::string rem = q;
2773 while (true)
2774 {
2775 auto pos = rem.find(">>");
2776 if (pos == std::string::npos)
2777 {
2778 while (!rem.empty() && rem.front() == ' ')
2779 rem.erase(0, 1);
2780 while (!rem.empty() && rem.back() == ' ')
2781 rem.pop_back();
2782 if (!rem.empty())
2783 parts.push_back(rem);
2784 break;
2785 }
2786 std::string part = rem.substr(0, pos);
2787 while (!part.empty() && part.front() == ' ')
2788 part.erase(0, 1);
2789 while (!part.empty() && part.back() == ' ')
2790 part.pop_back();
2791 if (!part.empty())
2792 parts.push_back(part);
2793 rem = rem.substr(pos + 2);
2794 }
2795
2796 const ParamClass* cur = configFile.get();
2797 std::string pathSoFar;
2798 for (size_t pi = 0; pi < parts.size() && cur; pi++)
2799 {
2800 const std::string& p = parts[pi];
2801 pathSoFar += (pathSoFar.empty() ? "" : " >> ") + p;
2802 const ParamEntry* found = cur->FindEntryNoInheritance(p.c_str());
2803 if (!found)
2804 {
2805 cur = nullptr;

Callers

nothing calls this directly

Calls 6

clearMethod · 0.80
sizeMethod · 0.80
GetClassInterfaceMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected