See previous commit

This commit is contained in:
Pasha Bibko
2025-07-21 18:05:46 +01:00
parent 5bfeb75536
commit ab5fb4f342

View File

@@ -11,30 +11,30 @@ namespace LXC::Util
// Enum to translate to the Win32 code for the colors // // Enum to translate to the Win32 code for the colors //
enum Color : WORD enum Color : WORD
{ {
DEFAULT = 0x07, DEFAULT = 0x07,
BLACK = 0x00, BLACK = 0x00,
BLUE = 0x01, BLUE = 0x01,
GREEN = 0x02, GREEN = 0x02,
AQUA = 0x03, AQUA = 0x03,
RED = 0x04, RED = 0x04,
PURPLE = 0x05, PURPLE = 0x05,
YELLOW = 0x06, YELLOW = 0x06,
LIGHT_GRAY = 0x07, LIGHT_GRAY = 0x07,
LIGHT_BLUE = 0x09, LIGHT_BLUE = 0x09,
LIGHT_GREEN = 0x0a, LIGHT_GREEN = 0x0a,
LIGHT_AQUA = 0x0b, LIGHT_AQUA = 0x0b,
LIGHT_RED = 0x0c, LIGHT_RED = 0x0c,
LIGHT_PURPLE = 0x0d, LIGHT_PURPLE = 0x0d,
LIGHT_YELLOW = 0x0e, LIGHT_YELLOW = 0x0e,
WHITE = 0x0f WHITE = 0x0f
}; };
} }
namespace LXC::Internal namespace LXC::Internal
{ {
// Checks if a type can be outputted to std::ostream // // Checks if a type can be outputted to std::ostream //
template<typename T> concept Logable = requires(std::ostream& os, T t) template<typename T> concept Logable = requires(std::ostream & os, T t)
{ {
// I have no idea what this part does at all // // I have no idea what this part does at all //
{ os << t } -> std::same_as<std::ostream&>; { os << t } -> std::same_as<std::ostream&>;
@@ -62,7 +62,7 @@ namespace LXC::Internal
inline void WriteImpl(std::ostream& os, Args&&... args) inline void WriteImpl(std::ostream& os, Args&&... args)
{ {
static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
if constexpr(col != Util::Color::DEFAULT) if constexpr (col != Util::Color::DEFAULT)
SetConsoleTextAttribute(hConsole, static_cast<WORD>(col)); SetConsoleTextAttribute(hConsole, static_cast<WORD>(col));
(os << ... << std::forward<Args>(args)); (os << ... << std::forward<Args>(args));