blob: 4b7f57c80df7fae0ba73b348469573c9adcb4a7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#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;
};
|