2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _LIBRARY_CFG_HPP_
|
|
|
|
#define _LIBRARY_CFG_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-10-30 05:37:55 +01:00
|
|
|
#include "Common.hpp"
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
2015-10-30 05:37:55 +01:00
|
|
|
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() noexcept
|
|
|
|
{
|
|
|
|
return m_Encoder.getHash();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
void Reset() noexcept
|
|
|
|
{
|
|
|
|
m_Encoder.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
String Compute(const String & str) noexcept
|
|
|
|
{
|
|
|
|
return m_Encoder(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
String GetHash() noexcept
|
|
|
|
{
|
|
|
|
return m_Encoder.getHash();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
void AddStr(const String & str) noexcept
|
|
|
|
{
|
|
|
|
m_Encoder.add(str.data(), str.length() * sizeof(String::value_type));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
T m_Encoder;
|
|
|
|
};
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
2015-10-30 05:37:55 +01:00
|
|
|
#endif // _LIBRARY_CFG_HPP_
|