mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Common/Utilities: Move EnumUtils' implementation struct from Trinity::Impl to Trinity::Impl::EnumUtilsImpl. This avoids confusing name clashes for other implementations in sub-namespaces of Trinity::Impl.
(cherry picked from commit 91744de316)
This commit is contained in:
@@ -108,7 +108,7 @@ def processFile(path, filename):
|
||||
output.write('#include "SmartEnum.h"\n')
|
||||
output.write('#include <stdexcept>\n')
|
||||
output.write('\n')
|
||||
output.write('namespace Trinity::Impl\n')
|
||||
output.write('namespace Trinity::Impl::EnumUtilsImpl\n')
|
||||
output.write('{\n')
|
||||
for name, values in enums:
|
||||
tag = ('data for enum \'%s\' in \'%s.h\' auto-generated' % (name, filename))
|
||||
|
||||
@@ -32,39 +32,36 @@ struct EnumText
|
||||
char const* const Description;
|
||||
};
|
||||
|
||||
namespace Trinity
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
namespace Impl
|
||||
template <typename Enum>
|
||||
struct EnumUtils
|
||||
{
|
||||
template <typename Enum>
|
||||
struct EnumUtils
|
||||
{
|
||||
static size_t Count();
|
||||
static EnumText ToString(Enum value);
|
||||
static Enum FromIndex(size_t index);
|
||||
static size_t ToIndex(Enum index);
|
||||
};
|
||||
}
|
||||
static size_t Count();
|
||||
static EnumText ToString(Enum value);
|
||||
static Enum FromIndex(size_t index);
|
||||
static size_t ToIndex(Enum index);
|
||||
};
|
||||
}
|
||||
|
||||
class EnumUtils
|
||||
{
|
||||
public:
|
||||
template <typename Enum>
|
||||
static size_t Count() { return Trinity::Impl::EnumUtils<Enum>::Count(); }
|
||||
static size_t Count() { return Trinity::Impl::EnumUtilsImpl::EnumUtils<Enum>::Count(); }
|
||||
template <typename Enum>
|
||||
static EnumText ToString(Enum value) { return Trinity::Impl::EnumUtils<Enum>::ToString(value); }
|
||||
static EnumText ToString(Enum value) { return Trinity::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); }
|
||||
template <typename Enum>
|
||||
static Enum FromIndex(size_t index) { return Trinity::Impl::EnumUtils<Enum>::FromIndex(index); }
|
||||
static Enum FromIndex(size_t index) { return Trinity::Impl::EnumUtilsImpl::EnumUtils<Enum>::FromIndex(index); }
|
||||
template <typename Enum>
|
||||
static uint32 ToIndex(Enum value) { return Trinity::Impl::EnumUtils<Enum>::ToIndex(value);}
|
||||
static uint32 ToIndex(Enum value) { return Trinity::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);}
|
||||
|
||||
template<typename Enum>
|
||||
static bool IsValid(Enum value)
|
||||
{
|
||||
try
|
||||
{
|
||||
Trinity::Impl::EnumUtils<Enum>::ToIndex(value);
|
||||
Trinity::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);
|
||||
return true;
|
||||
} catch (...)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/************************************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/*************************************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/***************************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/***********************************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/*******************************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/********************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/***************************************************************\
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "SmartEnum.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Trinity::Impl
|
||||
namespace Trinity::Impl::EnumUtilsImpl
|
||||
{
|
||||
|
||||
/**********************************************************************\
|
||||
|
||||
Reference in New Issue
Block a user