blob: c613d16dd54738389025b768b048c72ee5e3339c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
void RemoveAsciiControlSequences(char* str, bool allow_color_codes);
template <typename T> class ScopeGuard
{
public:
auto operator=(ScopeGuard&) = delete;
ScopeGuard(ScopeGuard&) = delete;
ScopeGuard(T callback)
: m_callback(callback)
{
}
~ScopeGuard()
{
if (!m_dismissed)
m_callback();
}
void Dismiss() { m_dismissed = true; }
private:
bool m_dismissed = false;
T m_callback;
};
|