diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Exceptions.h | 16 | ||||
-rw-r--r-- | includes/Handle.h | 1 | ||||
-rw-r--r-- | includes/Input.h | 1 |
3 files changed, 18 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)) { \ diff --git a/includes/Handle.h b/includes/Handle.h index f2b78ad..489ab75 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -53,6 +53,7 @@ class IO { class SeekableHandle : public Handle { public: + SeekableHandle() : m_wOffset(0), m_rOffset(0) { } virtual bool canSeek(); virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException); diff --git a/includes/Input.h b/includes/Input.h index 7f801f6..71e6845 100644 --- a/includes/Input.h +++ b/includes/Input.h @@ -9,6 +9,7 @@ class Input : public SeekableHandle { Input(const char * fname) throw (GeneralException); virtual void close() throw (GeneralException); virtual bool isClosed(); + virtual bool canRead(); virtual const char * getName(); virtual off_t getSize(); virtual time_t getMTime(); |