MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / GetHighlights

Method GetHighlights

DebugView++/LogView.cpp:713–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713std::vector<Highlight> CLogView::GetHighlights(const std::string& text) const
714{
715 std::vector<Highlight> highlights;
716
717 int highlightId = 1;
718 for (auto& filter : m_filter.messageFilters)
719 {
720 if (!filter.enable || filter.filterType != FilterType::Token)
721 continue;
722
723 std::sregex_iterator begin(text.begin(), text.end(), filter.re), end;
724 int id = ++highlightId;
725 for (auto tok = begin; tok != end; ++tok)
726 {
727 int first = 0;
728 int count = 1;
729 if (tok->size() > 1 && filter.matchType == MatchType::RegexGroups)
730 {
731 first = 1;
732 count = tok->size();
733 }
734 for (int i = first; i < count; ++i)
735 {
736 int beginIndex = ExpandedTabOffset(text, tok->position(i));
737 int endIndex = ExpandedTabOffset(text, tok->position(i) + tok->length(i));
738
739 if (filter.bgColor == Colors::Auto)
740 {
741 auto itc = m_matchColors.find(tok->str(i));
742 if (itc != m_matchColors.end())
743 InsertHighlight(highlights, Highlight(id, beginIndex, endIndex, TextColor(itc->second, Colors::Text)));
744 }
745 else
746 {
747 InsertHighlight(highlights, Highlight(id, beginIndex, endIndex, TextColor(filter.bgColor, filter.fgColor)));
748 }
749 }
750 }
751 }
752
753 InsertHighlight(highlights, text, Str(m_highlightText), TextColor(Colors::Highlight, Colors::Text));
754
755 return highlights;
756}
757
758void DrawHighlightedText(HDC hdc, const RECT& rect, std::wstring text, std::vector<Highlight> highlights, const Highlight& selection)
759{

Callers

nothing calls this directly

Calls 7

ExpandedTabOffsetFunction · 0.85
InsertHighlightFunction · 0.85
HighlightClass · 0.85
TextColorClass · 0.85
StrClass · 0.85
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected