Files
NazaraEngine/include/Nazara/Core/ParameterList.inl
Gawaboumga bbac0838dd Include-What-You-Use (#137)
* IWYU Core

* IWYU Noise

* IWYU Utility

* IWYU Audio

* IWYU Platform

* IWYU Lua

* IWYU Network

* IWYU Physics2D

* IWYU Physics3D

* IWYU Renderer

* IWYU Graphics

* IWYU NDKServer

* IWYU Fix

* Try to fix compilation

* Other fixes
2017-10-01 11:17:09 +02:00

42 lines
1.3 KiB
C++

// Copyright (C) 2017 Jérôme Leclercq
// 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/Debug.hpp>
namespace Nz
{
/*!
* \brief Iterates over every value of the parameter list
*
* \param callback Callback function called with every parameter contained in the list, which can return true to remove the key (or false to keep it)
*
* \remark Changing the ParameterList while iterating on it may cause bugs, but querying data is safe.
*/
inline void ParameterList::ForEach(const std::function<bool(const ParameterList& list, const String& name)>& callback)
{
for (auto it = m_parameters.begin(); it != m_parameters.end();)
{
if (callback(*this, it->first))
it = m_parameters.erase(it);
else
++it;
}
}
/*!
* \brief Iterates over every value of the parameter list
*
* \param callback Callback function called with every parameter contained in the list
*
* \remark Changing the ParameterList while iterating on it may cause bugs, but querying data is safe.
*/
inline void ParameterList::ForEach(const std::function<void(const ParameterList& list, const String& name)>& callback) const
{
for (auto& pair : m_parameters)
callback(*this, pair.first);
}
}
#include <Nazara/Core/DebugOff.hpp>