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

Function matches_filter

plugins/stockpiles/StockpileSerializer.cpp:225–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225static bool matches_filter(color_ostream& out, const vector<string>& filters, const string& name) {
226 for (auto & filter : filters) {
227 DEBUG(log, out).print("searching for '{}' in '{}'\n", filter, name);
228 if (std::search(name.begin(), name.end(), filter.begin(), filter.end(),
229 [](unsigned char ch1, unsigned char ch2) { return std::toupper(ch1) == std::toupper(ch2); }
230 ) != name.end())
231 return true;
232 }
233 return !filters.size();
234}
235
236static void set_flag(color_ostream& out, const char* name, const vector<string>& filters, bool all, char val, bool enabled, bool& elem) {
237 if ((all || enabled) && matches_filter(out, filters, name)) {

Callers 2

set_flagFunction · 0.85
set_filter_elemFunction · 0.85

Calls 5

toupperFunction · 0.85
printMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected