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-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire::Util
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
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 );
|
2017-10-17 20:13:01 +02:00
|
|
|
|
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-25 15:46:13 +02:00
|
|
|
|
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();
|
2017-08-15 19:47:58 +09:00
|
|
|
|
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
|