Documentation for Functor

Former-commit-id: d0bac2fa789631c9a56ba5636aa52f260f1cc6fd
This commit is contained in:
Gawaboumga 2016-02-21 14:41:58 +01:00
parent 61542b59d6
commit b62b694af8
2 changed files with 37 additions and 1 deletions

View File

@ -9,7 +9,7 @@
#include <Nazara/Core/Algorithm.hpp>
// Inspiré du code de la SFML par Laurent Gomila
// Inspired from the of code of the SFML by Laurent Gomila
namespace Nz
{

View File

@ -6,18 +6,40 @@
namespace Nz
{
/*!
* \class Nz::StdLogger
* \brief Core class that represents a functor
*/
/*!
* \brief Constructs a FunctorWithoutArgs object with a function
*
* \param func Function to execute
*/
template<typename F>
FunctorWithoutArgs<F>::FunctorWithoutArgs(F func) :
m_func(func)
{
}
/*!
* \brief Runs the function
*/
template<typename F>
void FunctorWithoutArgs<F>::Run()
{
m_func();
}
/*!
* \brief Constructs a FunctorWithoutArgs object with a function and its arguments
*
* \param func Function to execute
* \param args Arguments for the function
*/
template<typename F, typename... Args>
FunctorWithArgs<F, Args...>::FunctorWithArgs(F func, Args&&... args) :
m_func(func),
@ -25,12 +47,22 @@ namespace Nz
{
}
/*!
* \brief Runs the function
*/
template<typename F, typename... Args>
void FunctorWithArgs<F, Args...>::Run()
{
Apply(m_func, m_args);
}
/*!
* \brief Constructs a FunctorWithoutArgs object with a member function and an object
*
* \param func Member function to execute
* \param object Object to execute on
*/
template<typename C>
MemberWithoutArgs<C>::MemberWithoutArgs(void (C::*func)(), C* object) :
@ -39,6 +71,10 @@ namespace Nz
{
}
/*!
* \brief Runs the function
*/
template<typename C>
void MemberWithoutArgs<C>::Run()
{