MCPcopy Create free account
hub / github.com/Artikash/Textractor / ProcessSentence

Function ProcessSentence

extensions/regexfilter.cpp:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55} window;
56
57bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
58{
59 static auto _ = GetSelectedProcessId = (DWORD(*)())sentenceInfo["get selected process id"];
60 if (sentenceInfo["text number"] == 0) return false;
61 if (/*sentenceInfo["current select"] && */!regex) if (auto processName = GetModuleFilename(sentenceInfo["process id"]))
62 {
63 std::ifstream stream(REGEX_SAVE_FILE, std::ios::binary);
64 BlockMarkupIterator savedFilters(stream, Array<std::wstring_view>{ L"|PROCESS|", L"|FILTER|" });
65 std::vector<std::wstring> regexes;
66 while (auto read = savedFilters.Next()) if (read->at(0) == processName) regexes.push_back(std::move(read->at(1)));
67 if (!regexes.empty()) QMetaObject::invokeMethod(&window, std::bind(&Window::SetRegex, &window, S(regexes.back())), Qt::BlockingQueuedConnection);
68 }
69 concurrency::reader_writer_lock::scoped_lock_read readLock(m);
70 if (regex) sentence = std::regex_replace(sentence, regex.value(), replace);
71 return true;
72}

Callers

nothing calls this directly

Calls 3

GetModuleFilenameFunction · 0.85
SFunction · 0.85
NextMethod · 0.45

Tested by

no test coverage detected