1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00
sapphire/src/common/Util/Util.h

40 lines
883 B
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef _UTIL_H
#define _UTIL_H
#include <stdint.h>
2018-09-26 08:47:22 -04:00
#include <string>
2018-10-26 09:29:57 +02:00
#include <functional>
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
namespace Core::Util
{
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
2018-10-28 21:53:21 +01:00
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
2018-10-25 23:50:18 +02:00
2018-10-28 21:53:21 +01:00
void eraseAll( std::string& inOutStr, char remove );
void eraseAllIn( std::string& inOutStr, std::string& remove );
2018-10-26 08:25:20 +02:00
2018-10-28 21:53:21 +01:00
std::string toLowerCopy( const std::string& inStr );
2018-10-28 21:53:21 +01:00
uint64_t getTimeMs();
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
int64_t getTimeSeconds();
2018-10-28 21:53:21 +01:00
uint64_t getEorzeanTimeStamp();
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
2018-10-26 09:29:57 +02:00
2018-10-28 21:53:21 +01:00
template <class T>
inline void hashCombine( std::size_t& seed, const T& v )
{
std::hash< T > hasher;
seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
}
2018-10-26 09:29:57 +02:00
2017-08-08 13:53:47 +02:00
}
#endif