summaryrefslogtreecommitdiff
path: root/includes/Exceptions.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-10 23:09:53 -0700
committerPixel <pixel@nobis-crew.org>2011-10-10 23:31:07 -0700
commit67b6a78b347ab7ba269a52d772e79d12444f6e96 (patch)
tree5a105f61add7a5eaa8bd63a7182eecde84285b0e /includes/Exceptions.h
parent8ae349b49e16064e4d84b6cfd256e3ca7fb0cd60 (diff)
Adding a few more features to Input, and actually creating a slightly better ClassName system, when using gcc and libstdc++.
Diffstat (limited to 'includes/Exceptions.h')
-rw-r--r--includes/Exceptions.h16
1 files changed, 16 insertions, 0 deletions
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 <cxxabi.h>
#include <BString.h>
namespace Balau {
@@ -21,6 +22,21 @@ class GeneralException {
static inline void AssertHelper(const String & msg) throw(GeneralException) { throw GeneralException(msg); }
+class ClassName {
+ public:
+ template<typename T> ClassName(T * ptr);
+ ~ClassName() { free(m_demangled); }
+ const char * c_str() const { return m_demangled; }
+ private:
+ char * m_demangled;
+};
+
+template<typename T>
+ClassName::ClassName(T * ptr) {
+ int status;
+ m_demangled = abi::__cxa_demangle(typeid(*ptr).name(), 0, 0, &status);
+}
+
};
#define Assert(c) if (!(c)) { \