From 67b6a78b347ab7ba269a52d772e79d12444f6e96 Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 10 Oct 2011 23:09:53 -0700 Subject: Adding a few more features to Input, and actually creating a slightly better ClassName system, when using gcc and libstdc++. --- includes/Exceptions.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'includes/Exceptions.h') diff --git a/includes/Exceptions.h b/includes/Exceptions.h index 39f3239..b6730c1 100644 --- a/includes/Exceptions.h +++ b/includes/Exceptions.h @@ -1,5 +1,6 @@ #pragma once +#include #include namespace Balau { @@ -21,6 +22,21 @@ class GeneralException { static inline void AssertHelper(const String & msg) throw(GeneralException) { throw GeneralException(msg); } +class ClassName { + public: + template ClassName(T * ptr); + ~ClassName() { free(m_demangled); } + const char * c_str() const { return m_demangled; } + private: + char * m_demangled; +}; + +template +ClassName::ClassName(T * ptr) { + int status; + m_demangled = abi::__cxa_demangle(typeid(*ptr).name(), 0, 0, &status); +} + }; #define Assert(c) if (!(c)) { \ -- cgit v1.2.3