AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::Impl Namespace Reference

Namespaces

namespace  ChatCommands
 
namespace  EnumUtilsImpl
 
namespace  StringConvertImpl
 

Classes

struct  CastToVisitor
 
struct  CryptoGenericsImpl
 
struct  CurrentServerProcessHolder
 
struct  GenericBaseEncoding
 
class  GenericHash
 
struct  GenericHashImpl
 
class  GenericHMAC
 
class  MPSCQueueIntrusive
 C++ implementation of Dmitry Vyukov's lock-free MPSC queue (Intrusive). More...
 
class  MPSCQueueNonIntrusive
 C++ implementation of Dmitry Vyukov's lock-free MPSC queue (Non-Intrusive). More...
 

Functions

template<class T , class Tuple , std::size_t... I>
T * new_from_tuple (Tuple &&args, std::index_sequence< I... >)
 
AC_COMMON_API std::string ByteArrayToHexStr (uint8 const *bytes, std::size_t length, bool reverse=false)
 
AC_COMMON_API void HexStrToByteArray (std::string_view str, uint8 *out, std::size_t outlen, bool reverse=false)
 

Function Documentation

◆ ByteArrayToHexStr()

std::string Acore::Impl::ByteArrayToHexStr ( uint8 const *  bytes,
std::size_t  length,
bool  reverse = false 
)
546{
547 int32 init = 0;
548 int32 end = arrayLen;
549 int8 op = 1;
550
551 if (reverse)
552 {
553 init = arrayLen - 1;
554 end = -1;
555 op = -1;
556 }
557
558 std::ostringstream ss;
559 for (int32 i = init; i != end; i += op)
560 {
561 char buffer[4];
562 snprintf(buffer, sizeof(buffer), "%02X", bytes[i]);
563 ss << buffer;
564 }
565
566 return ss.str();
567}
std::int32_t int32
Definition Define.h:103
std::int8_t int8
Definition Define.h:105

Referenced by ByteArrayToHexStr(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), WardenMac::Init(), and WardenWin::Init().

◆ HexStrToByteArray()

void Acore::Impl::HexStrToByteArray ( std::string_view  str,
uint8 out,
std::size_t  outlen,
bool  reverse = false 
)
570{
571 ASSERT(str.size() == (2 * outlen));
572
573 int32 init = 0;
574 int32 end = int32(str.length());
575 int8 op = 1;
576
577 if (reverse)
578 {
579 init = int32(str.length() - 2);
580 end = -2;
581 op = -1;
582 }
583
584 uint32 j = 0;
585 for (int32 i = init; i != end; i += 2 * op)
586 {
587 char buffer[3] = { str[i], str[i + 1], '\0' };
588 out[j++] = uint8(strtoul(buffer, nullptr, 16));
589 }
590}
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
#define ASSERT
Definition Errors.h:68

References ASSERT.

Referenced by HexStrToByteArray().

◆ new_from_tuple()

template<class T , class Tuple , std::size_t... I>
T * Acore::Impl::new_from_tuple ( Tuple &&  args,
std::index_sequence< I... >   
)
53 {
54 return new T(std::get<I>(std::forward<Tuple>(args))...);
55 }