Compiles on UNIX based systems
This commit is contained in:
@@ -73,7 +73,7 @@ namespace LXC::Util
|
||||
};
|
||||
|
||||
// Finds the location of a given index within a file //
|
||||
inline bool GetFileLocationAtIndex(FileLocation& location, const std::string& file, __int32 index)
|
||||
inline bool GetFileLocationAtIndex(FileLocation& location, const std::string& file, uint32_t index)
|
||||
{
|
||||
// Resets location //
|
||||
location.line = 1;
|
||||
@@ -84,7 +84,7 @@ namespace LXC::Util
|
||||
return false;
|
||||
|
||||
// Finds the location //
|
||||
__int32 localIndex = 0;
|
||||
uint32_t localIndex = 0;
|
||||
while (localIndex != index)
|
||||
{
|
||||
if (file[localIndex] == '\n')
|
||||
|
||||
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
|
||||
|
||||
12
Common/LXC.h
12
Common/LXC.h
@@ -1,8 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
// MSVC Built in macros for non-MSVC enviroments //
|
||||
|
||||
#ifndef _UNLIKELY
|
||||
#define _UNLIKELY [[unlikely]]
|
||||
#endif // _UNLIKELY
|
||||
|
||||
#ifndef _LIKELY
|
||||
#define _LIKELY [[likely]]
|
||||
#endif // _LIKELY
|
||||
|
||||
// Standard libraries //
|
||||
|
||||
#include <unordered_map>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
// LXC util files //
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// Platform specific includes //
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#elif defined(__unix__)
|
||||
// No platform specific includes are needed for UNIX based systems //
|
||||
#else
|
||||
#error "Code is currently only supported on Win32"
|
||||
#endif // _WIN32
|
||||
#error "OS is not supported"
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user