From b62b694af82fb7b9fb235797dd08f13063ff952e Mon Sep 17 00:00:00 2001 From: Gawaboumga Date: Sun, 21 Feb 2016 14:41:58 +0100 Subject: [PATCH] Documentation for Functor Former-commit-id: d0bac2fa789631c9a56ba5636aa52f260f1cc6fd --- include/Nazara/Core/Functor.hpp | 2 +- include/Nazara/Core/Functor.inl | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/include/Nazara/Core/Functor.hpp b/include/Nazara/Core/Functor.hpp index 994ecc5ae..7ce9995a7 100644 --- a/include/Nazara/Core/Functor.hpp +++ b/include/Nazara/Core/Functor.hpp @@ -9,7 +9,7 @@ #include -// Inspiré du code de la SFML par Laurent Gomila +// Inspired from the of code of the SFML by Laurent Gomila namespace Nz { diff --git a/include/Nazara/Core/Functor.inl b/include/Nazara/Core/Functor.inl index 84ea8e76f..96c22b175 100644 --- a/include/Nazara/Core/Functor.inl +++ b/include/Nazara/Core/Functor.inl @@ -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 FunctorWithoutArgs::FunctorWithoutArgs(F func) : m_func(func) { } + /*! + * \brief Runs the function + */ + template void FunctorWithoutArgs::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 FunctorWithArgs::FunctorWithArgs(F func, Args&&... args) : m_func(func), @@ -25,12 +47,22 @@ namespace Nz { } + /*! + * \brief Runs the function + */ + template void FunctorWithArgs::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 MemberWithoutArgs::MemberWithoutArgs(void (C::*func)(), C* object) : @@ -39,6 +71,10 @@ namespace Nz { } + /*! + * \brief Runs the function + */ + template void MemberWithoutArgs::Run() {