Core/Stream: Add HashAppend overload
This commit is contained in:
@@ -23,8 +23,8 @@ namespace Nz
|
||||
{
|
||||
class ByteArray;
|
||||
|
||||
template<typename T> ByteArray ComputeHash(HashType hash, const T& v);
|
||||
template<typename T> ByteArray ComputeHash(AbstractHash& hash, const T& v);
|
||||
template<typename T> ByteArray ComputeHash(HashType hash, T&& v);
|
||||
template<typename T> ByteArray ComputeHash(AbstractHash& hash, T&& v);
|
||||
|
||||
inline bool HashAppend(AbstractHash* hash, const std::string_view& v);
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace Nz
|
||||
* \see ComputeHash
|
||||
*/
|
||||
template<typename T>
|
||||
ByteArray ComputeHash(HashType hash, const T& v)
|
||||
ByteArray ComputeHash(HashType hash, T&& v)
|
||||
{
|
||||
return ComputeHash(*AbstractHash::Get(hash), v);
|
||||
return ComputeHash(*AbstractHash::Get(hash), std::forward<T>(v));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -49,11 +49,11 @@ namespace Nz
|
||||
* \see ComputeHash
|
||||
*/
|
||||
template<typename T>
|
||||
ByteArray ComputeHash(AbstractHash& hash, const T& v)
|
||||
ByteArray ComputeHash(AbstractHash& hash, T&& v)
|
||||
{
|
||||
hash.Begin();
|
||||
|
||||
HashAppend(hash, v);
|
||||
HashAppend(hash, std::forward<T>(v));
|
||||
|
||||
return hash.End();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,8 @@ namespace Nz
|
||||
StreamOptionFlags m_streamOptions;
|
||||
UInt64 m_bufferCursor;
|
||||
};
|
||||
|
||||
NAZARA_CORE_API bool HashAppend(AbstractHash& hash, Stream& stream);
|
||||
}
|
||||
|
||||
#include <Nazara/Core/Stream.inl>
|
||||
|
||||
Reference in New Issue
Block a user