Compiles on UNIX based systems

This commit is contained in:
2025-07-21 19:57:05 +01:00
parent d6568a8d2f
commit cde435ba55
9 changed files with 65 additions and 28 deletions

View File

@@ -9,7 +9,7 @@
namespace LXC::Util
{
// Enum to translate to the Win32 code for the colors //
enum Color : WORD
enum Color
{
DEFAULT = 0x07,
@@ -57,6 +57,8 @@ namespace LXC::Internal
return sLog;
}
#if defined(_WIN32)
// Base function for all derived Print() functions //
template<Util::Color col, bool newLine, typename... Args>
inline void WriteImpl(std::ostream& os, Args&&... args)
@@ -73,6 +75,19 @@ namespace LXC::Internal
if constexpr (col != Util::Color::DEFAULT)
SetConsoleTextAttribute(hConsole, static_cast<WORD>(Util::Color::DEFAULT));
}
#elif defined(__unix__)
template<Util::Color clo, bool newLine, typename... Args>
inline void WriteImpl(std::ostream& os, Args&&... args)
{
(os << ... << std::forward<Args>(args));
if constexpr (newLine)
os << std::endl;
}
#endif
}
namespace LXC::Util