Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Demangle.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdlib>
4
#include <memory>
5
#include <string>
6
#include <typeinfo>
7
#if defined(__GNUG__) || defined(__clang__)
8
# include <cxxabi.h>
9
#endif
10
11
namespace
FunctionUtils
{
12
13
inline
std::string
DemangleTypeName
(
const
std::type_info &typeInfo)
14
{
15
#if defined(__GNUG__) || defined(__clang__)
16
int
status = 0;
17
if
(
auto
ptr = std::unique_ptr<
char
,
void
(*)(
void
*)>(
18
abi::__cxa_demangle(typeInfo.name(),
nullptr
,
nullptr
, &status), [](
void
*p) { std::free(p); });
19
status == 0 && ptr)
20
return
std::string(ptr.get());
21
#endif
22
return
typeInfo.name();
23
}
24
25
}
// namespace FunctionUtils
FunctionUtils
Definition
BaseFunction.hpp:6
FunctionUtils::DemangleTypeName
std::string DemangleTypeName(const std::type_info &typeInfo)
Definition
Demangle.hpp:13
src
utils
function-container
src
Demangle.hpp
Generated by
1.16.1