8#include "unicode_normalization.hpp"
9#include "unicode_grapheme_cluster_break.hpp"
10#include "../utility/utility.hpp"
11#include "../macros.hpp"
20 using char_type = hi::grapheme;
21 using int_type = std::make_signed_t<char_type::value_type>;
25 using comparison_category = std::strong_ordering;
27 constexpr static void assign(char_type& r, char_type
const& a)
noexcept
41 [[nodiscard]]
constexpr static bool eq(char_type a, char_type b)
noexcept
46 [[nodiscard]]
constexpr static bool lt(char_type a, char_type b)
noexcept
51 constexpr static char_type *
move(char_type *dst, char_type
const *src,
std::size_t count)
noexcept
53 hi_axiom_not_null(src);
54 hi_axiom_not_null(dst);
62 dst[i - 1] = src[i - 1];
68 constexpr static char_type *
copy(char_type *dst, char_type
const *src,
std::size_t count)
noexcept
70 hi_axiom_not_null(src);
71 hi_axiom_not_null(dst);
81 hi_axiom_not_null(s1);
82 hi_axiom_not_null(s2);
86 return s1[i] < s2[i] ? -1 : 1;
97 while (s[i] !=
'\0') {
103 constexpr static char_type
const *
find(
const char_type *p,
std::size_t count,
const char_type& ch)
noexcept
105 hi_axiom_not_null(p);
115 constexpr static char_type
to_char_type(int_type c)
noexcept
120 constexpr static int_type
to_int_type(char_type c)
noexcept
125 constexpr static bool eq_int_type(int_type c1, int_type c2)
noexcept
130 constexpr static int_type
eof()
noexcept
135 constexpr static int_type
not_eof(int_type e)
noexcept
137 return e < 0 ? 0 : e;
144hi_export
using gstring_view = std::basic_string_view<grapheme>;
147hi_export
using gstring = std::pmr::basic_string<grapheme>;
151[[
nodiscard]]
constexpr bool operator==(gstring_view
const &lhs, std::string_view
const &rhs)
noexcept
153 if (lhs.size() != rhs.size()) {
157 auto l_it = lhs.begin();
159 auto r_it = rhs.begin();
177hi_export
template<std::input_or_output_iterator It, std::sentinel_for<It> ItEnd>
180 language = language.expand();
182 for (
auto it = first;
it != last; ++
it) {
183 it->set_language_tag(language);
187hi_export [[
nodiscard]]
constexpr gstring set_language(gstring str, language_tag language)
noexcept
189 set_language(str.begin(), str.end(), language);
210hi_export
template<std::input_or_output_iterator It, std::sentinel_for<It> ItEnd>
212 requires(std::is_same_v<std::iter_value_t<It>,
grapheme>)
230 if (
not it->language()) {
233 it->set_language_tag(
it->language_tag().expand());
263 if (detail::breaks_grapheme(code_point,
break_state)) {
302 for (hilet c : rhs) {
317 for (hilet c : rhs) {
332 for (hilet c : rhs) {
345 return to_string(gstring_view{rhs});
355 for (hilet c : rhs) {
367 for (hilet c : rhs) {
constexpr std::u32string to_u32string(std::u32string_view rhs) noexcept
Identity conversion from UTF-32 to UTF-32.
Definition to_string.hpp:24
constexpr std::wstring to_wstring(std::u32string_view rhs) noexcept
Conversion from UTF-32 to wide-string (UTF-16/32).
Definition to_string.hpp:156
DOXYGEN BUG.
Definition algorithm.hpp:16
hi_export constexpr void fix_language(It first, ItEnd last, language_tag default_language_tag) noexcept
Fix the language for the string.
Definition gstring.hpp:211
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:306
hi_export constexpr void set_language(It first, ItEnd last, language_tag language) noexcept
Set the language for the string.
Definition gstring.hpp:178
hi_export constexpr gstring to_gstring(std::u32string_view rhs, unicode_normalize_config config=unicode_normalize_config::NFC()) noexcept
Convert a UTF-32 string-view to a grapheme-string.
Definition gstring.hpp:254
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Definition grapheme.hpp:147
A grapheme-cluster, what a user thinks a character is.
Definition grapheme.hpp:160
Definition unicode_normalization.hpp:22
Tag used in constructors to set the intrinsic value of that object.
Definition misc.hpp:86
T to_char_type(T... args)