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

39 lines
849 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-26 09:29:57 +02:00
namespace Core::Util {
2017-08-08 13:53:47 +02:00
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
2017-10-17 22:52:12 +02:00
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
2018-10-25 23:50:18 +02:00
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
2018-10-26 08:25:20 +02:00
void eraseAll( std::string& inOutStr, char remove );
2018-10-26 09:40:47 +02:00
void eraseAllIn( std::string& inOutStr, std::string& remove );
2018-10-26 08:25:20 +02:00
2018-10-25 23:50:18 +02:00
std::string toLowerCopy( const std::string& inStr );
2017-08-08 13:53:47 +02:00
uint64_t getTimeMs();
int64_t getTimeSeconds();
2017-08-08 13:53:47 +02:00
uint64_t getEorzeanTimeStamp();
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
2018-10-26 09:29:57 +02: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 );
2017-08-08 13:53:47 +02:00
}
2018-10-26 09:29:57 +02:00
2017-08-08 13:53:47 +02:00
}
#endif