Antkeeper  0.0.1
console.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Christopher J. Howard
3  *
4  * This file is part of Antkeeper source code.
5  *
6  * Antkeeper source code is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Antkeeper source code is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include <engine/debug/console.hpp>
21 
22 #if defined(_WIN32)
23  #define WIN32_LEAN_AND_MEAN
24  #include <windows.h>
25 #endif
26 
27 namespace debug {
28 namespace console {
29 
31 {
32  #if defined(_WIN32)
33  DWORD mode = 0;
34  HANDLE std_output_handle = GetStdHandle(STD_OUTPUT_HANDLE);
35  GetConsoleMode(std_output_handle, &mode);
36  SetConsoleMode(std_output_handle, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
37  #endif
38 }
39 
41 {
42  #if defined(_WIN32)
43  DWORD mode = 0;
44  HANDLE std_output_handle = GetStdHandle(STD_OUTPUT_HANDLE);
45  GetConsoleMode(std_output_handle, &mode);
46  SetConsoleMode(std_output_handle, mode & (~ENABLE_VIRTUAL_TERMINAL_PROCESSING));
47  #endif
48 }
49 
51 {
52  #if defined(_WIN32)
53  SetConsoleOutputCP(CP_UTF8);
54  #endif
55 }
56 
57 } // namespace console
58 } // namespace debug
void enable_vt100()
Enables VT100 virtual terminal sequences.
Definition: console.cpp:30
void disable_vt100()
Disables VT100 virtual terminal sequences.
Definition: console.cpp:40
void enable_utf8()
Enables UTF-8 output.
Definition: console.cpp:50
Debugging functions and classes.
Definition: cli.cpp:22