Core: Add ObjectLibrary::Clear

This commit is contained in:
Lynix 2018-07-01 00:36:59 +02:00
parent 217d971fe7
commit eeaaebb15c
3 changed files with 15 additions and 2 deletions

View File

@ -118,6 +118,7 @@ Nazara Engine:
- SocketPoller will now silently ignore "interrupt errors"
- Added RigidBody2D::ClosestPointQuery
- Fix Sprite copy constructor not copying corner colors
- Added ObjectLibrary::Clear method
Nazara Development Kit:
- Added ImageWidget (#139)

View File

@ -23,6 +23,8 @@ namespace Nz
ObjectLibrary() = delete;
~ObjectLibrary() = delete;
static void Clear();
static ObjectRef<Type> Get(const String& name);
static bool Has(const String& name);

View File

@ -2,6 +2,7 @@
// 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/ObjectLibrary.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Debug.hpp>
@ -9,10 +10,19 @@ namespace Nz
{
/*!
* \ingroup core
* \class Nz::ObjectRef
* \brief Core class that represents a reference to an object
* \class Nz::ObjectLibrary
* \brief Core class containing a collection of objects
*/
/*!
* \brief Clears the library, freeing every object it contains
*/
template<typename Type>
void ObjectLibrary<Type>::Clear()
{
Type::s_library.clear();
}
/*!
* \brief Gets the ObjectRef object by name
* \return Optional reference