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 "exception.hpp"
8
#include "utils.hpp"
9
10
namespace
tt {
11
12
#define tt_parse_check(expression, ...) \
13
do { \
14
if (!(expression)) { \
15
if constexpr (::tt::nr_arguments(__VA_ARGS__) == 0) { \
16
throw ::tt::parse_error(#expression); \
17
} else { \
18
throw ::tt::parse_error(__VA_ARGS__); \
19
} \
20
} \
21
} while (false)
22
23
#define tt_hresult_check(expression) \
24
([](HRESULT result) { \
25
if (FAILED(result)) { \
26
throw ::tt::io_error("Call to '{}' failed with {:08x}", #expression, result); \
27
} \
28
return result; \
29
}(expression))
30
31
}
Generated on Mon Apr 22 2024 12:53:41 for HikoGUI by
1.10.0