xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd.core
include
xtd
internal
__xtd_scope.hpp
Go to the documentation of this file.
1
4
#pragma once
6
#if !defined(__XTD_CORE_INTERNAL__)
7
#error "Do not include this file: Internal use only"
8
#endif
10
11
#include <exception>
12
14
#define __xtd_finally_cat__(name, line) name##line
15
#define __xtd_finally_id__(name, line) __xtd_finally_cat__(name, line)
16
17
#define __xtd_scope_cat__(name, line) name##line
18
#define __xtd_scope_id__(name, line) __xtd_scope_cat__(name, line)
19
20
template
<
typename
function_t>
21
struct
__xtd_finally_object__ {
22
__xtd_finally_object__(function_t&& f) :
function
(std::forward<function_t>(
f
)) {}
23
~__xtd_finally_object__() {
function
(); }
24
function_t
function
;
25
};
26
27
template
<
typename
function_t>
28
struct
__xtd_scope_exit_object__ {
29
__xtd_scope_exit_object__(function_t&& f) :
function
(std::forward<function_t>(
f
)) {}
30
~__xtd_scope_exit_object__() {
function
(); }
31
function_t
function
;
32
};
33
34
template
<
typename
function_t>
35
struct
__xtd_scope_fail_object__ {
36
__xtd_scope_fail_object__(function_t&& f) :
function
(std::forward<function_t>(
f
)) {}
37
~__xtd_scope_fail_object__() noexcept {
if
(std::uncaught_exceptions() > exceptions_on_enter)
function
();}
38
int
exceptions_on_enter = std::uncaught_exceptions();
39
function_t
function
;
40
};
41
42
template
<
typename
function_t>
43
struct
__xtd_scope_success_object__ {
44
__xtd_scope_success_object__(function_t&& f) :
function
(std::forward<function_t>(
f
)) {}
45
~__xtd_scope_success_object__() noexcept {
if
(std::uncaught_exceptions() == exceptions_on_enter)
function
();}
46
int
exceptions_on_enter = std::uncaught_exceptions();
47
function_t
function
;
48
};
xtd::console_key::f
@ f
The F key.
Definition
console_key.hpp:98
xtd::forms::keys::function
@ function
The FUNCTION modifier key.
Definition
keys.hpp:480
Generated on
for xtd by
Gammasoft
. All rights reserved.