Make use of the new EnumMap class

This commit is contained in:
SirLynix
2023-05-30 12:32:37 +02:00
parent d914f41404
commit dfe6b2ddcf
46 changed files with 354 additions and 379 deletions

View File

@@ -4,6 +4,7 @@
#include <Nazara/Core/AbstractLogger.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <NazaraUtils/EnumMap.hpp>
#include <sstream>
#include <Nazara/Core/Debug.hpp>
@@ -11,14 +12,12 @@ namespace Nz
{
namespace NAZARA_ANONYMOUS_NAMESPACE
{
const char* errorType[] = {
constexpr EnumMap<ErrorType, std::string_view> s_errorTypes = {
"Assert failed: ", // ErrorType::AssertFailed
"Internal error: ", // ErrorType::Internal
"Error: ", // ErrorType::Normal
"Warning: " // ErrorType::Warning
};
static_assert(sizeof(errorType) / sizeof(const char*) == ErrorTypeCount, "Error type array is incomplete");
}
/*!
@@ -44,7 +43,7 @@ namespace Nz
NAZARA_USE_ANONYMOUS_NAMESPACE
std::ostringstream ss;
ss << errorType[UnderlyingCast(type)] << error;
ss << s_errorTypes[type] << error;
if (line != 0 && file && function)
ss << " (" << file << ':' << line << ": " << function << ')';