MCPcopy Create free account
hub / github.com/DFHack/dfhack / applyFilterIds

Function applyFilterIds

plugins/debug.cpp:847–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

845
846template<typename HighlightRed,typename ListComplete>
847static command_result applyFilterIds(color_ostream& out,
848 std::vector<std::string>& parameters,
849 const char* name,
850 HighlightRed hlRed,
851 ListComplete listComplete)
852{
853 if (1u >= parameters.size()) {
854 ERR(command,out) << name << " requires at least a filter id" << std::endl;
855 return CR_WRONG_USAGE;
856 }
857 command_result rv = CR_OK;
858 {
859 auto& catMan = DebugManager::getInstance();
860 std::lock_guard<std::mutex> lock(catMan.access_mutex_);
861 auto& filMan = FilterManager::getInstance();
862 unsigned line = 0;
863 for (size_t pos = 1; pos < parameters.size(); ++pos) {
864 const std::string& p = parameters[pos];
865 auto iter = parseFilterId(out, p);
866 if (iter == filMan.end())
867 continue;
868 color_value c = (line & 1) == 0 ? COLOR_CYAN : COLOR_LIGHTCYAN;
869 if (hlRed(iter))
870 c = COLOR_RED;
871 printFilterListEntry(out,line++,c,iter->first,iter->second);
872 }
873 rv = listComplete();
874 }
875 out.color(COLOR_RESET);
876 out.flush();
877 return rv;
878}
879
880//! Handler for debugfilter disable
881static command_result disableFilter(color_ostream& out,

Callers 3

disableFilterFunction · 0.85
enableFilterFunction · 0.85
unsetFilterFunction · 0.85

Calls 6

parseFilterIdFunction · 0.85
printFilterListEntryFunction · 0.85
sizeMethod · 0.45
endMethod · 0.45
colorMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected