TrinityCore
Loading...
Searching...
No Matches
Trinity::Impl Namespace Reference

Namespaces

namespace  ChatCommands
 
namespace  EnumUtilsImpl
 
namespace  StringConvertImpl
 

Classes

struct  CastToVisitor
 
struct  CryptoGenericsImpl
 
struct  GenericBaseEncoding
 
class  GenericHash
 
struct  GenericHashImpl
 
class  GenericHMAC
 
class  MPSCQueueIntrusive
 
class  MPSCQueueNonIntrusive
 
struct  SpawnObjectTypeForImpl
 
struct  SpawnObjectTypeForImpl< AreaTrigger >
 
struct  SpawnObjectTypeForImpl< Creature >
 
struct  SpawnObjectTypeForImpl< GameObject >
 
struct  unique_ptr_deleter
 

Functions

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

Function Documentation

◆ ByteArrayToHexStr()

std::string Trinity::Impl::ByteArrayToHexStr ( uint8 const *  bytes,
size_t  length,
bool  reverse = false 
)

Definition at line 833 of file Util.cpp.

834{
835 int32 init = 0;
836 int32 end = arrayLen;
837 int8 op = 1;
838
839 if (reverse)
840 {
841 init = arrayLen - 1;
842 end = -1;
843 op = -1;
844 }
845
846 std::ostringstream ss;
847 for (int32 i = init; i != end; i += op)
848 {
849 char buffer[4];
850 sprintf(buffer, "%02X", bytes[i]);
851 ss << buffer;
852 }
853
854 return ss.str();
855}
int8_t int8
Definition: Define.h:141
int32_t int32
Definition: Define.h:139
+ Here is the caller graph for this function:

◆ GetTypeName()

std::string Trinity::Impl::GetTypeName ( std::type_info const &  info)

Definition at line 896 of file Util.cpp.

897{
898 return boost::core::demangle(info.name());
899}
+ Here is the caller graph for this function:

◆ HexStrToByteArray()

void Trinity::Impl::HexStrToByteArray ( std::string_view  str,
uint8 out,
size_t  outlen,
bool  reverse = false 
)

Definition at line 857 of file Util.cpp.

858{
859 ASSERT(str.size() == (2 * outlen));
860
861 int32 init = 0;
862 int32 end = int32(str.length());
863 int8 op = 1;
864
865 if (reverse)
866 {
867 init = int32(str.length() - 2);
868 end = -2;
869 op = -1;
870 }
871
872 uint32 j = 0;
873 for (int32 i = init; i != end; i += 2 * op)
874 {
875 char buffer[3] = { str[i], str[i + 1], '\0' };
876 out[j++] = uint8(strtoul(buffer, nullptr, 16));
877 }
878}
uint8_t uint8
Definition: Define.h:145
uint32_t uint32
Definition: Define.h:143
#define ASSERT
Definition: Errors.h:68
+ Here is the caller graph for this function:

◆ new_from_tuple()

template<class T , class Tuple , size_t... I>
T * Trinity::Impl::new_from_tuple ( Tuple &&  args,
std::index_sequence< I... >   
)

Definition at line 52 of file Tuples.h.

53 {
54 return new T(std::get<I>(std::forward<Tuple>(args))...);
55 }