HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
spell_check.hpp
1
2#pragma once
3
4namespace hi {
5inline namespace v1 {
6
8public:
9 class error_type {
10 public:
11 language_tag language;
12 size_t offset;
13 size_t size;
14
21 [[nodiscard]] std::vector<gstring> suggestions() const noexcept;
22
23 private:
24 spell_errors *_ptr;
25
26 error_type(spell_errors *self, size_t offset, size_t size) noexcept : offset(offset), size(size), _ptr(self) {}
27 };
28
29private:
31};
32
33
34[[nodiscard]] spell_errors check_spelling(gstring text, language_tag language, size_t offset = 0) noexcept;
35
36template<typename It, std::sentinal_for<It> ItEnd>
37[[nodiscard]] spell_errors check_spelling(It first, ItEnd last) noexcept
38 requires (std::is_same_v<std::iter_value_t<It>, character>)
39{
40 if (first == last) {
41 return;
42 }
43
44 auto r = spell_errors{};
45
46 auto run_language = first->attributes().language_tag();
47 auto run_start = first;
48 for (auto it = first + 1; it != last; ++it) {
49 auto language = it->attributes().language_tag();
50 if (language != run_language) {
51 //r += check_spelling(to_gstring(text),
52 }
53 }
54
55
56 return r;
57}
58
59}}
60
STL namespace.
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
The standard HikoGUI character type.
Definition character.hpp:34
Definition spell_check.hpp:7
Definition spell_check.hpp:9
std::vector< gstring > suggestions() const noexcept
Get the replacements for this error.