HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
check.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 "exception.hpp"
8
#include <format>
9
10
namespace
hi::inline
v1
{
11
12
#define hi_parse_check(expression, message, ...) \
13
do { \
14
if (!(expression)) { \
15
if constexpr (__VA_OPT__(not ) false) { \
16
throw ::hi::parse_error(std::format(message __VA_OPT__(, ) __VA_ARGS__)); \
17
} else { \
18
throw ::hi::parse_error(message); \
19
} \
20
} \
21
} while (false)
22
23
#define hi_hresult_check(expression) \
24
([](HRESULT result) { \
25
if (FAILED(result)) { \
26
throw ::hi::io_error(std::format("Call to '{}' failed with {:08x}", #expression, result)); \
27
} \
28
return result; \
29
}(expression))
30
31
}
// namespace hi::inline v1
v1
DOXYGEN BUG.
Definition
algorithm.hpp:15
Generated on Mon Apr 22 2024 12:52:03 for HikoGUI by
1.10.0