8#include "unicode_normalization.hpp"
9#include "unicode_grapheme_cluster_break.hpp"
10#include "../utility/module.hpp"
11#include "../strings.hpp"
17 using char_type = hi::grapheme;
22 using comparison_category = std::strong_ordering;
24 static constexpr void assign(char_type& r, char_type
const& a)
noexcept
38 [[nodiscard]]
static constexpr bool eq(char_type a, char_type b)
noexcept
43 [[nodiscard]]
static constexpr bool lt(char_type a, char_type b)
noexcept
48 static constexpr char_type *
move(char_type *dst, char_type
const *src,
std::size_t count)
noexcept
59 dst[i - 1] = src[i - 1];
65 static constexpr char_type *
copy(char_type *dst, char_type
const *src,
std::size_t count)
noexcept
83 return s1[i] < s2[i] ? -1 : 1;
94 while (s[i] !=
'\0') {
100 static constexpr char_type
const *
find(
const char_type *p,
std::size_t count,
const char_type& ch)
noexcept
114 auto tmp = hi::char_cast<char_type::value_type>(c);
115 if (tmp > 0x1f'ffff) {
123 return hi::char_cast<int_type>(c.intrinsic());
145namespace hi::inline
v1 {
148using gstring_view = std::basic_string_view<grapheme>;
151using gstring = std::pmr::basic_string<grapheme>;
163[[nodiscard]]
constexpr gstring
169 auto break_state = detail::grapheme_break_state{};
172 for (
hilet code_point : normalized_string) {
173 if (detail::breaks_grapheme(code_point, break_state)) {
174 if (cluster.size() > 0) {
181 cluster += code_point;
183 if (ssize(cluster) != 0) {
199[[nodiscard]]
constexpr gstring
214[[nodiscard]]
constexpr gstring
217 return to_gstring(std::string_view{rhs}, config);
229 for (
hilet c : rhs) {
244 for (
hilet c : rhs) {
259 for (
hilet c : rhs) {
282 for (
hilet c : rhs) {
294 for (
hilet c : rhs) {
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:199
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:253
#define hi_axiom_not_null(expression,...)
Assert if an expression is not nullptr.
Definition assert.hpp:272
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
constexpr std::string to_string(std::u32string_view rhs) noexcept
Conversion from UTF-32 to UTF-8.
Definition to_string.hpp:215
constexpr std::u32string to_u32string(std::u32string_view rhs) noexcept
Identity conversion from UTF-32 to UTF-32.
Definition to_string.hpp:23
constexpr std::wstring to_wstring(std::u32string_view rhs) noexcept
Conversion from UTF-32 to wide-string (UTF-16/32).
Definition to_string.hpp:155
DOXYGEN BUG.
Definition algorithm.hpp:13
constexpr std::u32string unicode_normalize(std::u32string_view text, unicode_normalize_config config=unicode_normalize_config::NFC()) noexcept
Convert text to a Unicode composed normal form.
Definition unicode_normalization.hpp:303
geometry/margins.hpp
Definition cache.hpp:11
Definition grapheme.hpp:29
A grapheme-cluster, what a user thinks a character is.
Definition grapheme.hpp:42
Definition unicode_normalization.hpp:19
Tag used in constructors to set the intrinsic value of that object.
Definition utility.hpp:242
T to_char_type(T... args)