summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/debug_utils.h
blob: 8b45f0d65c836c52310c18f326c6072f9fde9fc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef AUDIOGRAPHER_DEBUG_UTILS_H
#define AUDIOGRAPHER_DEBUG_UTILS_H

#include <string>

#ifdef __GNUC__
#include <cxxabi.h>
#endif

namespace AudioGrapher
{

struct DebugUtils
{
	template<typename T>
	static std::string demangled_name (T const & obj)
	{
#ifdef __GNUC__
		int status;
		char * res = abi::__cxa_demangle (typeid(obj).name(), 0, 0, &status);
		if (status == 0) {
			std::string s(res);
			free (res);
			return s;
		}
#endif
		return typeid(obj).name();
	}
	
};

} // namespace

#endif // AUDIOGRAPHER_DEBUG_UTILS_H