Remove deprecated module template
This commit is contained in:
parent
790815e9ee
commit
e9f3e39194
|
|
@ -1,15 +0,0 @@
|
|||
MODULE.Name = "ModuleName"
|
||||
|
||||
MODULE.Libraries = {
|
||||
"NazaraCore"
|
||||
}
|
||||
|
||||
MODULE.OsFiles.Windows = {
|
||||
"../src/Nazara/ModuleName/Win32/**.hpp",
|
||||
"../src/Nazara/ModuleName/Win32/**.cpp"
|
||||
}
|
||||
|
||||
MODULE.OsFiles.Posix = {
|
||||
"../src/Nazara/ModuleName/Posix/**.hpp",
|
||||
"../src/Nazara/ModuleName/Posix/**.cpp"
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CLASSNAME_HPP
|
||||
#define NAZARA_CLASSNAME_HPP
|
||||
|
||||
#include <Nazara/ModuleName/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_MODULENAME_API ClassName
|
||||
{
|
||||
public:
|
||||
ClassName();
|
||||
|
||||
int GetAttribute() const;
|
||||
|
||||
void SetAttribute(int attribute);
|
||||
|
||||
private:
|
||||
int m_attribute;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_CLASSNAME_HPP
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
Nazara Engine - Module name
|
||||
|
||||
Copyright (C) YEAR AUTHORS (EMAIL)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CONFIG_MODULENAME_HPP
|
||||
#define NAZARA_CONFIG_MODULENAME_HPP
|
||||
|
||||
/// Each modification of a parameter needs a recompilation of the module
|
||||
|
||||
// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower)
|
||||
#define NAZARA_MODULENAME_MANAGE_MEMORY 0
|
||||
|
||||
// Activate the security tests based on the code (Advised for development)
|
||||
#define NAZARA_MODULENAME_SAFE 1
|
||||
|
||||
/// Each modification of a parameter following implies a modification (often minor) of the code
|
||||
|
||||
/// Checking the values and types of certain constants
|
||||
#include <Nazara/ModuleName/ConfigCheck.hpp>
|
||||
|
||||
#if !defined(NAZARA_STATIC)
|
||||
#ifdef NAZARA_MODULENAME_BUILD
|
||||
#define NAZARA_MODULENAME_API NAZARA_EXPORT
|
||||
#else
|
||||
#define NAZARA_MODULENAME_API NAZARA_IMPORT
|
||||
#endif
|
||||
#else
|
||||
#define NAZARA_MODULENAME_API
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CONFIG_CHECK_MODULENAME_HPP
|
||||
#define NAZARA_CONFIG_CHECK_MODULENAME_HPP
|
||||
|
||||
/// This file is used to check the constant values defined in Config.hpp
|
||||
|
||||
#include <type_traits>
|
||||
#define CheckType(name, type, err) static_assert(std::is_ ##type <decltype(name)>::value, #type err)
|
||||
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||
|
||||
// We force the value of MANAGE_MEMORY in debug
|
||||
#if defined(NAZARA_DEBUG) && !NAZARA_MODULENAME_MANAGE_MEMORY
|
||||
#undef NAZARA_MODULENAME_MANAGE_MEMORY
|
||||
#define NAZARA_MODULENAME_MANAGE_MEMORY 0
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_CONFIG_CHECK_MODULENAME_HPP
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/ModuleName/Config.hpp>
|
||||
#if NAZARA_MODULENAME_MANAGE_MEMORY
|
||||
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||
#endif
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// We suppose that Debug.hpp is already included, same goes for Config.hpp
|
||||
#if NAZARA_MODULENAME_MANAGE_MEMORY
|
||||
#undef delete
|
||||
#undef new
|
||||
#endif
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_MODULENAME_HPP
|
||||
#define NAZARA_MODULENAME_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Initializer.hpp>
|
||||
#include <Nazara/ModuleName/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_MODULENAME_API ModuleName
|
||||
{
|
||||
public:
|
||||
ModuleName() = delete;
|
||||
~ModuleName() = delete;
|
||||
|
||||
static bool Initialize();
|
||||
|
||||
static bool IsInitialized();
|
||||
|
||||
static void Uninitialize();
|
||||
|
||||
private:
|
||||
static unsigned int s_moduleReferenceCounter;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_MODULENAME_HPP
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/ModuleName/ClassName.hpp>
|
||||
#include <Nazara/ModuleName/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
ClassName::ClassName() :
|
||||
m_attribute(42)
|
||||
{
|
||||
}
|
||||
|
||||
int ClassName::GetAttribute() const
|
||||
{
|
||||
return m_attribute;
|
||||
}
|
||||
|
||||
void ClassName::SetAttribute(int attribute)
|
||||
{
|
||||
m_attribute = attribute;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (C) 2014 AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/ModuleName/Config.hpp>
|
||||
#if NAZARA_MODULENAME_MANAGE_MEMORY
|
||||
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <new> // Nécessaire ?
|
||||
|
||||
void* operator new(std::size_t size)
|
||||
{
|
||||
return Nz::MemoryManager::Allocate(size, false);
|
||||
}
|
||||
|
||||
void* operator new[](std::size_t size)
|
||||
{
|
||||
return Nz::MemoryManager::Allocate(size, true);
|
||||
}
|
||||
|
||||
void operator delete(void* pointer) noexcept
|
||||
{
|
||||
Nz::MemoryManager::Free(pointer, false);
|
||||
}
|
||||
|
||||
void operator delete[](void* pointer) noexcept
|
||||
{
|
||||
Nz::MemoryManager::Free(pointer, true);
|
||||
}
|
||||
|
||||
#endif // NAZARA_MODULENAME_MANAGE_MEMORY
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
// Copyright (C) YEAR AUTHORS
|
||||
// This file is part of the "Nazara Engine - Module name"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/ModuleName/ModuleName.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/ModuleName/Config.hpp>
|
||||
#include <Nazara/ModuleName/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
bool ModuleName::Initialize()
|
||||
{
|
||||
if (s_moduleReferenceCounter > 0)
|
||||
{
|
||||
s_moduleReferenceCounter++;
|
||||
return true; // Already initialized
|
||||
}
|
||||
|
||||
// Initialize module dependencies
|
||||
if (!Core::Initialize())
|
||||
{
|
||||
NazaraError("Failed to initialize core module");
|
||||
return false;
|
||||
}
|
||||
|
||||
s_moduleReferenceCounter++;
|
||||
|
||||
CallOnExit onExit(ModuleName::Uninitialize);
|
||||
|
||||
// Initialize module here
|
||||
|
||||
onExit.Reset();
|
||||
|
||||
NazaraNotice("Initialized: ModuleName module");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ModuleName::IsInitialized()
|
||||
{
|
||||
return s_moduleReferenceCounter != 0;
|
||||
}
|
||||
|
||||
void ModuleName::Uninitialize()
|
||||
{
|
||||
if (s_moduleReferenceCounter != 1)
|
||||
{
|
||||
// Either the module is not initialized, either it was initialized multiple times
|
||||
if (s_moduleReferenceCounter > 1)
|
||||
s_moduleReferenceCounter--;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
s_moduleReferenceCounter = 0;
|
||||
|
||||
// Uninitialize module here
|
||||
|
||||
NazaraNotice("Uninitialized: ModuleName module");
|
||||
|
||||
// Free module dependencies
|
||||
Core::Uninitialize();
|
||||
}
|
||||
|
||||
unsigned int ModuleName::s_moduleReferenceCounter = 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue