HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
check.hpp
1
// Copyright Take Vos 2020.
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 "error_info.hpp"
8
#include "source_location.hpp"
9
#include "exception.hpp"
10
#include "utils.hpp"
11
12
namespace
tt {
13
14
#define tt_parse_check(expression, ...) \
15
do { \
16
if (!(expression)) { \
17
::tt::error_info(::tt::source_location(__LINE__, 0, __FILE__, __func__)); \
18
if constexpr (::tt::nr_arguments(__VA_ARGS__) == 0) { \
19
throw ::tt::parse_error(#expression); \
20
} else { \
21
throw ::tt::parse_error(__VA_ARGS__); \
22
} \
23
} \
24
} while (false)
25
26
#define tt_hresult_check(expression) \
27
([](HRESULT result) { \
28
if (FAILED(result)) { \
29
::tt::error_info(tt::source_location(__LINE__, 0, __FILE__, __func__)); \
30
throw ::tt::io_error("Call to '{}' failed with {:08x}", #expression, result); \
31
} \
32
return result; \
33
}(expression))
34
35
}
Generated on Mon Apr 22 2024 12:53:48 for HikoGUI by
1.10.0