Fix documentation for module: Core
Former-commit-id: a79bf956a2759c6056e4e4e2193b8b192c5727c5
This commit is contained in:
@@ -10,6 +10,17 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \class Nz::HandledObject<T>
|
||||
* \brief Core class that represents a handled object
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a HandledObject object by assignation
|
||||
*
|
||||
* \param object HandledObject to assign into this
|
||||
*/
|
||||
template<typename T>
|
||||
HandledObject<T>::HandledObject(const HandledObject& object)
|
||||
{
|
||||
@@ -17,6 +28,11 @@ namespace Nz
|
||||
// Don't copy anything, we're a copy of the object, we have no handle right now
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a HandledObject object by move semantic
|
||||
*
|
||||
* \param object HandledObject to move into this
|
||||
*/
|
||||
template<typename T>
|
||||
HandledObject<T>::HandledObject(HandledObject&& object) :
|
||||
m_handles(std::move(object.m_handles))
|
||||
@@ -25,25 +41,46 @@ namespace Nz
|
||||
handle->OnObjectMoved(static_cast<T*>(this));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destructs the object and calls UnregisterAllHandles
|
||||
*
|
||||
* \see UnregisterAllHandles
|
||||
*/
|
||||
template<typename T>
|
||||
HandledObject<T>::~HandledObject()
|
||||
{
|
||||
UnregisterAllHandles();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Creates a ObjectHandle for this
|
||||
* \return ObjectHandle to this
|
||||
*/
|
||||
template<typename T>
|
||||
ObjectHandle<T> HandledObject<T>::CreateHandle()
|
||||
{
|
||||
return ObjectHandle<T>(static_cast<T*>(this));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the reference of the HandledObject with the handle from another
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param object The other HandledObject
|
||||
*/
|
||||
template<typename T>
|
||||
HandledObject<T>& HandledObject<T>::operator=(const HandledObject& object)
|
||||
{
|
||||
// Nothing to do
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the HandledObject into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param object HandledObject to move in this
|
||||
*/
|
||||
template<typename T>
|
||||
HandledObject<T>& HandledObject<T>::operator=(HandledObject&& object)
|
||||
{
|
||||
@@ -54,13 +91,22 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Registers a handle
|
||||
*
|
||||
* \param handle Handle to register
|
||||
*
|
||||
* \remark One handle can only be registered once, errors can occur if it's more than once
|
||||
*/
|
||||
template<typename T>
|
||||
void HandledObject<T>::RegisterHandle(ObjectHandle<T>* handle)
|
||||
{
|
||||
///DOC: Un handle ne doit être enregistré qu'une fois, des erreurs se produisent s'il l'est plus d'une fois
|
||||
m_handles.push_back(handle);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unregisters all handles
|
||||
*/
|
||||
template<typename T>
|
||||
void HandledObject<T>::UnregisterAllHandles()
|
||||
{
|
||||
@@ -71,10 +117,17 @@ namespace Nz
|
||||
m_handles.clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unregisters a handle
|
||||
*
|
||||
* \param handle Handle to unregister
|
||||
*
|
||||
* \remark One handle can only be unregistered once, crash can occur if it's more than once
|
||||
* \remark Produces a NazaraAssert if handle not registered
|
||||
*/
|
||||
template<typename T>
|
||||
void HandledObject<T>::UnregisterHandle(ObjectHandle<T>* handle) noexcept
|
||||
{
|
||||
///DOC: Un handle ne doit être libéré qu'une fois, et doit faire partie de la liste, sous peine de crash
|
||||
auto it = std::find(m_handles.begin(), m_handles.end(), handle);
|
||||
NazaraAssert(it != m_handles.end(), "Handle not registered");
|
||||
|
||||
@@ -83,6 +136,14 @@ namespace Nz
|
||||
m_handles.pop_back();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates one handle with another
|
||||
*
|
||||
* \param oldHandle Old handle to replace
|
||||
* \param newHandle New handle to take place
|
||||
*
|
||||
* \remark Produces a NazaraAssert if handle not registered
|
||||
*/
|
||||
template<typename T>
|
||||
void HandledObject<T>::UpdateHandle(ObjectHandle<T>* oldHandle, ObjectHandle<T>* newHandle) noexcept
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user