Rename Module to ModuleBase

This commit is contained in:
Jérôme Leclercq 2020-09-11 13:39:18 +02:00
parent a7fac3beb8
commit fd1d416510
20 changed files with 40 additions and 40 deletions

View File

@ -16,9 +16,9 @@
namespace Nz
{
class NAZARA_AUDIO_API Audio : public Module<Audio>
class NAZARA_AUDIO_API Audio : public ModuleBase<Audio>
{
friend Module;
friend ModuleBase;
using Dependencies = TypeList<Core>;

View File

@ -8,14 +8,14 @@
#define NAZARA_CORE_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Module.hpp>
#include <Nazara/Core/ModuleBase.hpp>
#include <Nazara/Core/TypeList.hpp>
namespace Nz
{
class NAZARA_CORE_API Core : public Module<Core>
class NAZARA_CORE_API Core : public ModuleBase<Core>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<>;

View File

@ -13,7 +13,7 @@
namespace Nz
{
template<typename T>
class Module
class ModuleBase
{
friend class Core;
@ -21,13 +21,13 @@ namespace Nz
static T* Instance();
protected:
Module(std::string moduleName, T* pointer);
~Module();
ModuleBase(std::string moduleName, T* pointer);
~ModuleBase();
private:
struct NoLog {};
Module(std::string moduleName, T* pointer, NoLog);
ModuleBase(std::string moduleName, T* pointer, NoLog);
void LogInit();
@ -35,6 +35,6 @@ namespace Nz
};
}
#include <Nazara/Core/Module.inl>
#include <Nazara/Core/ModuleBase.inl>
#endif // NAZARA_MODULE_HPP

View File

@ -2,21 +2,21 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Module.hpp>
#include <Nazara/Core/ModuleBase.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
template<typename T>
Module<T>::Module(std::string moduleName, T* pointer) :
Module(std::move(moduleName), pointer, NoLog{})
ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer) :
ModuleBase(std::move(moduleName), pointer, NoLog{})
{
LogInit();
}
template<typename T>
Module<T>::Module(std::string moduleName, T* pointer, NoLog) :
ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer, NoLog) :
m_moduleName(std::move(moduleName))
{
NazaraAssert(T::s_instance == nullptr, "only one instance of " + m_moduleName + " must exist at a given time");
@ -24,20 +24,20 @@ namespace Nz
}
template<typename T>
Module<T>::~Module()
ModuleBase<T>::~ModuleBase()
{
NazaraNotice("Uninitializing " + m_moduleName + "...");
T::s_instance = nullptr;
}
template<typename T>
T* Module<T>::Instance()
T* ModuleBase<T>::Instance()
{
return T::s_instance;
}
template<typename T>
void Module<T>::LogInit()
void ModuleBase<T>::LogInit()
{
NazaraNotice("Initializing " + m_moduleName + "...");
}

View File

@ -13,9 +13,9 @@
namespace Nz
{
class NAZARA_NETWORK_API Network : public Module<Network>
class NAZARA_NETWORK_API Network : public ModuleBase<Network>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Core>;

View File

@ -13,9 +13,9 @@
namespace Nz
{
class NAZARA_PHYSICS2D_API Physics2D : public Module<Physics2D>
class NAZARA_PHYSICS2D_API Physics2D : public ModuleBase<Physics2D>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Core>;

View File

@ -13,9 +13,9 @@
namespace Nz
{
class NAZARA_PHYSICS3D_API Physics3D : public Module<Physics3D>
class NAZARA_PHYSICS3D_API Physics3D : public ModuleBase<Physics3D>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Core>;

View File

@ -13,9 +13,9 @@
namespace Nz
{
class NAZARA_PLATFORM_API Platform : public Module<Platform>
class NAZARA_PLATFORM_API Platform : public ModuleBase<Platform>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Utility>;

View File

@ -18,9 +18,9 @@ namespace Nz
class AbstractBuffer;
class Buffer;
class NAZARA_RENDERER_API Renderer : public Module<Renderer>
class NAZARA_RENDERER_API Renderer : public ModuleBase<Renderer>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Platform>;

View File

@ -13,9 +13,9 @@
namespace Nz
{
class NAZARA_SHADER_API Shader : public Module<Shader>
class NAZARA_SHADER_API Shader : public ModuleBase<Shader>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Core>;

View File

@ -13,9 +13,9 @@
namespace Nz
{
class NAZARA_UTILITY_API Utility : public Module<Utility>
class NAZARA_UTILITY_API Utility : public ModuleBase<Utility>
{
friend Module;
friend ModuleBase;
public:
using Dependencies = TypeList<Core>;

View File

@ -24,7 +24,7 @@ namespace Nz
*/
Audio::Audio() :
Module("Audio", this)
ModuleBase("Audio", this)
{
// Initialisation of OpenAL
if (!OpenAL::Initialize())

View File

@ -20,7 +20,7 @@ namespace Nz
*/
Core::Core() :
Module("Core", this, Module::NoLog{})
ModuleBase("Core", this, ModuleBase::NoLog{})
{
Log::Initialize();

View File

@ -32,7 +32,7 @@ namespace Nz
*/
Network::Network() :
Module("Network", this)
ModuleBase("Network", this)
{
// Initialize module here
if (!SocketImpl::Initialize())

View File

@ -8,7 +8,7 @@
namespace Nz
{
Physics2D::Physics2D() :
Module("Physics2D", this)
ModuleBase("Physics2D", this)
{
}

View File

@ -14,7 +14,7 @@
namespace Nz
{
Physics3D::Physics3D() :
Module("Physics3D", this)
ModuleBase("Physics3D", this)
{
if (!Collider3D::Initialize())
throw std::runtime_error("failed to initialize colliders");

View File

@ -18,7 +18,7 @@ namespace Nz
*/
Platform::Platform() :
Module("Platform", this)
ModuleBase("Platform", this)
{
if (!Window::Initialize())
throw std::runtime_error("failed to initialize window system");

View File

@ -31,7 +31,7 @@
namespace Nz
{
Renderer::Renderer() :
Module("Renderer", this)
ModuleBase("Renderer", this)
{
struct RendererImplementations
{

View File

@ -8,7 +8,7 @@
namespace Nz
{
Shader::Shader() :
Module("Shader", this)
ModuleBase("Shader", this)
{
}

View File

@ -37,7 +37,7 @@ namespace Nz
*/
Utility::Utility() :
Module("Utility", this)
ModuleBase("Utility", this)
{
if (!Animation::Initialize())
throw std::runtime_error("failed to initialize animations");