-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommandLine.hpp
More file actions
39 lines (29 loc) · 1.27 KB
/
Copy pathcommandLine.hpp
File metadata and controls
39 lines (29 loc) · 1.27 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <map>
#include <memory>
#include <string>
#include <Windows.h>
class CommandLine {
HANDLE console_handle_out;
public:
static constexpr int LINE_SIZE = 8192;
static constexpr short COLOR_DEFAULT = 7;
CommandLine() :
console_handle_out(GetStdHandle(STD_OUTPUT_HANDLE)) {}
CommandLine(const CommandLine& that) = default;
CommandLine(CommandLine&& that) noexcept = default;
CommandLine& operator=(const CommandLine& that) = default;
CommandLine& operator=(CommandLine&& that) noexcept = default;
~CommandLine() = default;
void setColor(short color = 7) const;
void setCursorVisibility(bool value) const;
void setConInfo(CONSOLE_SCREEN_BUFFER_INFOEX& info) const;
void setScreenDims(const COORD& dims) const;
void remapColors(const std::map<int, std::string>& colorMap) const;
void goTo(const COORD& pos) const;
void write(const std::string& text, short color, const COORD& pos) const;
[[nodiscard]] std::unique_ptr<CONSOLE_SCREEN_BUFFER_INFOEX> getConInfo() const;
[[nodiscard]] std::unique_ptr<COORD> getScreenDims() const;
[[nodiscard]] static std::string getEnvVar(const std::string& name);
[[nodiscard]] static std::string expandEnvironmentVariables(const std::string& in);
};