Convert all remaining enums to enum classes (!)

This commit is contained in:
Jérôme Leclercq
2021-05-25 00:08:50 +02:00
parent 8cdd0b51cb
commit 874fb3542e
122 changed files with 1082 additions and 2169 deletions

View File

@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/AbstractLogger.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <sstream>
#include <Nazara/Core/Debug.hpp>
@@ -11,13 +12,13 @@ namespace Nz
namespace
{
const char* errorType[] = {
"Assert failed: ", // ErrorType_AssertFailed
"Internal error: ", // ErrorType_Internal
"Error: ", // ErrorType_Normal
"Warning: " // ErrorType_Warning
"Assert failed: ", // ErrorType::AssertFailed
"Internal error: ", // ErrorType::Internal
"Error: ", // ErrorType::Normal
"Warning: " // ErrorType::Warning
};
static_assert(sizeof(errorType) / sizeof(const char*) == ErrorType_Max + 1, "Error type array is incomplete");
static_assert(sizeof(errorType) / sizeof(const char*) == ErrorTypeCount, "Error type array is incomplete");
}
/*!
@@ -27,7 +28,6 @@ namespace Nz
*
* \remark This class is abstract
*/
AbstractLogger::~AbstractLogger() = default;
/*!
@@ -39,11 +39,10 @@ namespace Nz
* \param file Filename
* \param function Name of the function throwing the error
*/
void AbstractLogger::WriteError(ErrorType type, const std::string_view& error, unsigned int line, const char* file, const char* function)
{
std::ostringstream ss;
ss << errorType[type] << error;
ss << errorType[UnderlyingCast(type)] << error;
if (line != 0 && file && function)
ss << " (" << file << ':' << line << ": " << function << ')';