CoriEngine
Loading...
Searching...
No Matches
CleanTypeName.hpp
Go to the documentation of this file.
1
#ifndef CLEANTYPENAME_HPP
2
#define CLEANTYPENAME_HPP
3
4
#if defined(PLATFORM_LINUX) || defined(PLATFORM_MINGW)
5
#ifndef DEMANGLE_BUFFER_SIZE
6
#define DEMANGLE_BUFFER_SIZE 128
7
#endif
8
#include <cxxabi.h>
9
10
namespace
Cori
{
11
namespace
internal {
12
inline
const
char
* Demangle(
const
char
* mangledName,
char
* buffer,
size_t
size) {
13
int
status = 0;
14
15
char
* demangledName = abi::__cxa_demangle(mangledName, buffer, &size, &status);
16
17
if
(status == 0) {
18
return
demangledName;
19
}
20
21
return
mangledName;
22
}
23
}
24
}
25
26
31
#define CORI_DEMANGLE(name) \
32
([](const char* mangled) -> const char* { \
33
thread_local char buffer[DEMANGLE_BUFFER_SIZE]; \
34
return Cori::internal::Demangle(mangled, buffer, sizeof(buffer)); \
35
})(name)
36
41
#define CORI_CLEAN_TYPE_NAME(tn) CORI_DEMANGLE(typeid(tn).name())
42
43
#else
44
45
#define CORI_DEMANGLE(name) name
46
47
#define CORI_CLEAN_TYPE_NAME(tn) typeid(tn).name()
48
49
#endif
50
51
#endif
Cori
Global engine namespace.
Definition
AssetLoadStatus.hpp:3
CoriEngine
Engine
src
Utility
CleanTypeName.hpp
Generated by
1.14.0