HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
unicode_break_opportunity.hpp
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../utility/utility.hpp"
8#include "../macros.hpp"
9#include <format>
10#include <ostream>
11#include <vector>
12
13
14
15namespace hi::inline v1 {
16
17enum class unicode_break_opportunity : uint8_t {
18 no,
19 yes,
20 mandatory,
21 unassigned,
22};
23
24using unicode_break_vector = std::vector<unicode_break_opportunity>;
25using unicode_break_iterator = unicode_break_vector::iterator;
26using unicode_break_const_iterator = unicode_break_vector::const_iterator;
27
28inline std::ostream &operator<<(std::ostream &lhs, unicode_break_opportunity const &rhs) {
29 hilet *s = [&] () {
30 switch (rhs) {
31 using enum unicode_break_opportunity;
32 case no: return "X";
33 case yes: return ":";
34 case mandatory: return "!";
35 case unassigned: return "-";
36 default: hi_no_default();
37 }
38 }();
39 return lhs << s;
40}
41
42}
43
44template<typename CharT>
45struct std::formatter<hi::unicode_break_opportunity, CharT> : std::formatter<char const *, CharT> {
46 auto format(hi::unicode_break_opportunity const &t, auto &fc) const
47 {
48 hilet *s = [&]() {
49 switch (t) {
50 using enum hi::unicode_break_opportunity;
51 case no: return "X";
52 case yes: return ":";
53 case mandatory: return "!";
54 case unassigned: return "-";
55 default: hi_no_default();
56 }
57 }();
58 return std::formatter<char const *, CharT>::format(s, fc);
59 }
60};
DOXYGEN BUG.
Definition algorithm.hpp:16
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