10#include "../macros.hpp"
17hi_export_module(hikogui.utility.exception : intf);
19hi_export
namespace hi {
inline namespace v1 {
59 template<
typename It,
typename... Args>
60 [[nodiscard]]
constexpr parse_error(It first, It last,
int tab_size,
char const *msg, Args
const&...args) noexcept :
61 runtime_error(make_what(first, last, tab_size, msg, args...))
72 template<
typename It,
typename... Args>
73 [[nodiscard]]
constexpr parse_error(It first, It last,
char const *msg, Args
const&...args) noexcept :
89 auto column_nr = 0_uz;
91 auto c32 =
char32_t{};
92 auto continue_count =
int{};
93 while (first != last) {
96 if ((c8 & 0xc0) == 0x80) {
101 }
else if (c8 & 0x80) {
102 continue_count = std::countl_one(c8) - 1;
103 c32 = c8 & (0b00'111'111 >> continue_count);
110 if (not continue_count) {
125 column_nr /= tab_size;
126 column_nr *= tab_size;
133 return {line_nr, column_nr};
137 template<
typename It,
typename... Args>
139 make_what(It first, It last,
size_t tab_size,
char const *msg, Args
const&...args)
noexcept
142 return {std::format(
"{}:{}: {}", line_nr + 1, column_nr + 1, std::format(msg, args...))};
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
constexpr Out char_cast(In rhs) noexcept
Cast a character.
Definition cast.hpp:550
std::string get_last_error_message()
Get the OS error message from the last error received on this thread.
Definition exception_win32_impl.hpp:31
Exception thrown during parsing on an error.
Definition exception_intf.hpp:47
constexpr parse_error(It first, It last, char const *msg, Args const &...args) noexcept
Create a parse error at a specific point in UTF-8 encoded text.
Definition exception_intf.hpp:73
static constexpr std::pair< size_t, size_t > get_line_position(It first, It last, size_t tab_size) noexcept
Get the line and column position of an iterator in a UTF-8 string.
Definition exception_intf.hpp:86
constexpr parse_error(It first, It last, int tab_size, char const *msg, Args const &...args) noexcept
Create a parse error at a specific point in UTF-8 encoded text.
Definition exception_intf.hpp:60
Exception thrown when an item was not found.
Definition exception_intf.hpp:148
Exception thrown during execution of a dynamic operation.
Definition exception_intf.hpp:160
Exception thrown during I/O on an error.
Definition exception_intf.hpp:172
Exception thrown during an operating system call.
Definition exception_intf.hpp:183
Definition exception_intf.hpp:188
Definition exception_intf.hpp:193
Definition exception_intf.hpp:198
Definition exception_intf.hpp:203
Definition exception_intf.hpp:208
Cancel error is caused by user pressing cancel.
Definition exception_intf.hpp:217