spellcheck_utils.h 927 B

1234567891011121314151617181920212223242526272829303132333435
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. #include "spellcheck/spellcheck_types.h"
  9. #include <QLocale>
  10. namespace Spellchecker {
  11. constexpr auto kMaxWordSize = 99;
  12. QChar::Script LocaleToScriptCode(const QString &locale);
  13. QChar::Script WordScript(QStringView word);
  14. bool IsWordSkippable(
  15. QStringView word,
  16. bool checkSupportedScripts = true);
  17. MisspelledWords RangesFromText(
  18. const QString &text,
  19. Fn<bool(const QString &word)> filterCallback);
  20. // For Linux and macOS, which use RangesFromText.
  21. bool CheckSkipAndSpell(const QString &word);
  22. QLocale LocaleFromLangId(int langId);
  23. void UpdateSupportedScripts(std::vector<QString> languages);
  24. rpl::producer<> SupportedScriptsChanged();
  25. } // namespace Spellchecker