11#include "../unicode/unicode_description.hpp"
16namespace hi::inline
v1 {
50 inplace_min(_value, max_value(size));
54 constexpr text_cursor resize(
size_t size) &&
noexcept
56 inplace_min(_value, max_value(size));
68 _value = (index << 1) | static_cast<size_t>(after);
83 [[nodiscard]]
constexpr text_cursor after_neighbor(
size_t size)
const noexcept
85 return before() ? neighbor(size) : *this;
88 [[nodiscard]]
constexpr text_cursor before_neighbor(
size_t size)
const noexcept
90 return after() ? neighbor(size) : *this;
93 [[nodiscard]]
constexpr bool start_of_text() const noexcept
98 [[nodiscard]]
constexpr bool end_of_text(
size_t size)
const noexcept
100 return _value >= max_value(size);
103 [[nodiscard]]
constexpr size_t index() const noexcept
108 [[nodiscard]]
constexpr bool after() const noexcept
110 return to_bool(_value & 1);
113 [[nodiscard]]
constexpr bool before() const noexcept
124 [[nodiscard]]
constexpr static size_t max_value(
size_t size)
noexcept
Utilities to assert and bound check.
Miscellaneous math functions.
Utilities used by the HikoGUI library itself.
DOXYGEN BUG.
Definition algorithm.hpp:15
A cursor-position in text.
Definition text_cursor.hpp:25
constexpr text_cursor & resize(size_t size) &noexcept
Set the text size.
Definition text_cursor.hpp:48
constexpr text_cursor(size_t index, bool after) noexcept
Create a new text cursor.
Definition text_cursor.hpp:66
constexpr text_cursor neighbor(size_t size) const noexcept
Return the neighbor cursor.
Definition text_cursor.hpp:77