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

Function SaveCache

extensions/translatewrapper.cpp:43–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 return FormatString("%s Cache (%S).txt", TRANSLATION_PROVIDER, tlp->translateTo);
42 }
43 void SaveCache()
44 {
45 std::wstring allTranslations(L"\xfeff");
46 for (const auto& [sentence, translation] : translationCache.Acquire().contents)
47 allTranslations.append(L"|SENTENCE|").append(sentence).append(L"|TRANSLATION|").append(translation).append(L"|END|\r\n");
48 std::ofstream(CacheFile(), std::ios::binary | std::ios::trunc).write((const char*)allTranslations.c_str(), allTranslations.size() * sizeof(wchar_t));
49 savedSize = translationCache->size();
50 }
51 void LoadCache()
52 {
53 translationCache->clear();

Callers 3

~WindowMethod · 0.85
SaveTranslateToMethod · 0.85
ProcessSentenceFunction · 0.85

Calls 2

CacheFileFunction · 0.85
AcquireMethod · 0.80

Tested by

no test coverage detected