Files
NazaraEngine/include/Nazara/Core/Algorithm.hpp
Lynix f434b753ff Core/Algorithm: Add serialize/unserialize overload for std::string
Former-commit-id: c4aa07b3ab8fcac85ac290ae5168bd841ce16dfd [formerly ee0f4fa822ec65aa72d43c9ab370402976713206] [formerly 9ec403e92a60b8ca97d7bc3e579ca5983089ba76 [formerly d7e17cc3ff72d43e23f11a70d785efcff3f4cba2]]
Former-commit-id: 190337087a987ca5ef1ac9789f04e3b9f2fc47af [formerly fc6bed4363a90b165db7fde093a6df37eeb9f45a]
Former-commit-id: 28d6dfe4b4217e91a7283e0fbe45d20ac982f79c
2016-09-25 01:48:57 +02:00

57 lines
1.8 KiB
C++

// Copyright (C) 2015 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
#pragma once
#ifndef NAZARA_ALGORITHM_CORE_HPP
#define NAZARA_ALGORITHM_CORE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Core/SerializationContext.hpp>
#include <functional>
#include <string>
#include <tuple>
#include <type_traits>
namespace Nz
{
class AbstractHash;
class ByteArray;
template<typename F, typename Tuple> auto Apply(F&& fn, Tuple&& t);
template<typename O, typename F, typename Tuple> auto Apply(O& object, F&& fn, Tuple&& t);
template<typename T> ByteArray ComputeHash(HashType hash, const T& v);
template<typename T> ByteArray ComputeHash(AbstractHash* hash, const T& v);
template<typename T, std::size_t N> constexpr std::size_t CountOf(T(&name)[N]) noexcept;
template<typename T> std::size_t CountOf(const T& c);
template<typename T> void HashCombine(std::size_t& seed, const T& v);
template<typename T> T ReverseBits(T integer);
template<typename T>
struct PointedType
{
using type = void; //< FIXME: I can't make SFINAE work
};
template<typename T>
struct TypeTag {};
inline bool Serialize(SerializationContext& context, bool value);
inline bool Serialize(SerializationContext& context, const std::string& value);
template<typename T>
std::enable_if_t<std::is_arithmetic<T>::value, bool> Serialize(SerializationContext& context, T value);
inline bool Unserialize(SerializationContext& context, bool* value);
inline bool Unserialize(SerializationContext& context, std::string* value);
template<typename T>
std::enable_if_t<std::is_arithmetic<T>::value, bool> Unserialize(SerializationContext& context, T* value);
}
#include <Nazara/Core/Algorithm.inl>
#endif // NAZARA_ALGORITHM_CORE_HPP