summaryrefslogtreecommitdiff
path: root/includes
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
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')
-rw-r--r--includes/Exceptions.h16
-rw-r--r--includes/Handle.h1
-rw-r--r--includes/Input.h1
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();