#pragma once #include "console_channel.h" #include #include #include #include namespace dragonx { namespace ui { struct ConsoleOutputFilter { std::string text; bool daemonMessagesEnabled = true; // Daemon + Xmrig (node log) channels bool errorsOnly = false; // keep only the Error channel bool rpcTraceEnabled = false; // Rpc channel bool appMessagesEnabled = true; // App channel }; // Alloc-free ASCII case-insensitive substring search (C-locale fold). Returns the byte // offset of the first match at or after `from`, or npos. Needle is folded on the fly. size_t FindCaseInsensitive(const char* hay, size_t hayLen, const std::string& needle, size_t from); // Whether a line with the given channel + text passes the active filter. bool consoleLinePassesFilter(const std::string& lineText, ConsoleChannel channel, const ConsoleOutputFilter& filter); // Incrementally maintain a FLAT (filtered, fold-free) visible set across model appends/evictions. `visible` holds // ascending raw indices computed for the absolute window [oldFirst, oldEnd); the model now spans // [newFirst, newFirst + n). Drops evicted indices, rebases the survivors and appends every new raw index in // [oldEnd - newFirst, n) for which passes(i) is true. Returns false (visible untouched) when the windows do not // chain; the caller then rescans. Only valid while the filter is unchanged (line text/channel are immutable). bool ExtendFlatVisibleIndices(std::vector& visible, std::uint64_t oldFirst, std::uint64_t oldEnd, std::uint64_t newFirst, int n, const std::function& passes); } // namespace ui } // namespace dragonx