Compiles on UNIX based systems
This commit is contained in:
17
Common/IO.h
17
Common/IO.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user