#include "console_output_model.h" #include #include namespace dragonx { namespace ui { namespace { std::string lowerCopy(std::string value) { std::transform(value.begin(), value.end(), value.begin(), [](unsigned char c) { return static_cast(std::tolower(c)); }); return value; } } bool consoleLinePassesFilter(const std::string& lineText, ImU32 lineColor, const ConsoleOutputFilter& filter) { if (!filter.daemonMessagesEnabled && lineColor == filter.daemonColor) return false; if (!filter.rpcTraceEnabled && lineColor == filter.rpcTraceColor) return false; if (filter.errorsOnly && lineColor != filter.errorColor) return false; if (!filter.text.empty()) { std::string needle = lowerCopy(filter.text); std::string haystack = lowerCopy(lineText); if (haystack.find(needle) == std::string::npos) return false; } return true; } } // namespace ui } // namespace dragonx