1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00
SqMod/source/Library/Hashing.hpp
2015-11-01 05:48:01 +02:00

96 lines
2.6 KiB
C++

#ifndef _LIBRARY_CFG_HPP_
#define _LIBRARY_CFG_HPP_
// ------------------------------------------------------------------------------------------------
#include "Common.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* ...
*/
template < class T > class HashWrapper
{
public:
/* --------------------------------------------------------------------------------------------
* ...
*/
HashWrapper() = default;
/* --------------------------------------------------------------------------------------------
* ...
*/
HashWrapper(const HashWrapper & o) = default;
/* --------------------------------------------------------------------------------------------
* ...
*/
HashWrapper(HashWrapper && o) = default;
/* --------------------------------------------------------------------------------------------
* ...
*/
~HashWrapper() = default;
/* --------------------------------------------------------------------------------------------
* ...
*/
HashWrapper & operator = (const HashWrapper & o) = default;
/* --------------------------------------------------------------------------------------------
* ...
*/
HashWrapper & operator = (HashWrapper && o) = default;
/* --------------------------------------------------------------------------------------------
* ...
*/
String ToString()
{
return m_Encoder.getHash();
}
/* --------------------------------------------------------------------------------------------
* ...
*/
void Reset()
{
m_Encoder.reset();
}
/* --------------------------------------------------------------------------------------------
* ...
*/
String Compute(const String & str)
{
return m_Encoder(str);
}
/* --------------------------------------------------------------------------------------------
* ...
*/
String GetHash()
{
return m_Encoder.getHash();
}
/* --------------------------------------------------------------------------------------------
* ...
*/
void AddStr(const String & str)
{
m_Encoder.add(str.data(), str.length() * sizeof(String::value_type));
}
private:
// --------------------------------------------------------------------------------------------
T m_Encoder;
};
} // Namespace:: SqMod
#endif // _LIBRARY_CFG_HPP_