MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / DoFind

Method DoFind

WinArk/KernelPoolView.cpp:531–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

529}
530
531void CKernelPoolView::DoFind(const CString& text, DWORD flags) {
532 auto searchDown = flags & FR_DOWN;
533
534 int start = GetSelectedIndex();
535 CString find(text);
536 auto ignoreCase = !(flags & FR_MATCHCASE);
537 if (ignoreCase)
538 find.MakeLower();
539
540 int from = searchDown ? start + 1 : start - 1 + GetItemCount();
541 int to = searchDown ? GetItemCount() + start : start + 1;
542 int step = searchDown ? 1 : -1;
543
544 int findIndex = -1;
545 for (int i = from; i != to; i += step) {
546 int index = i % GetItemCount();
547 const auto& item = m_Tags[index];
548 CString text(item->Tag);
549 if (ignoreCase)
550 text.MakeLower();
551 if (text.Find(find) >= 0) {
552 findIndex = index;
553 break;
554 }
555 text = item->SourceName;
556 if (ignoreCase)
557 text.MakeLower();
558 if (text.Find(find) >= 0) {
559 findIndex = index;
560 break;
561 }
562 }
563
564 if (findIndex >= 0) {
565 SelectItem(findIndex);
566 }
567 else
568 AtlMessageBox(m_hWnd, L"Not found");
569}
570
571

Callers

nothing calls this directly

Calls 1

FindMethod · 0.80

Tested by

no test coverage detected