summaryrefslogtreecommitdiff
path: root/includes/Handle.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-23 08:48:56 -0800
committerPixel <pixel@nobis-crew.org>2011-11-23 08:48:56 -0800
commitb78404d7662298a27706bc08e86e9bde7a6baa66 (patch)
treee575ee14fa2a6bb9067c819b9a1c622cf4727f9c /includes/Handle.h
parente10639753d7dbd368f5edc2555d75c4b5905ba3b (diff)
Adding the isA<>() template / method to the IO proxy, and optimizing the BStream using it, in case one never wants to use the readString() or peekByte() methods.
Diffstat (limited to 'includes/Handle.h')
-rw-r--r--includes/Handle.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/Handle.h b/includes/Handle.h
index 99aa3a5..f304086 100644
--- a/includes/Handle.h
+++ b/includes/Handle.h
@@ -87,6 +87,8 @@ class IO : public IOBase {
IO(const IO<T> & io) { if (io.m_h) setHandle(io.m_h); }
template<class U>
IO(const IO<U> & io) { if (io.m_h) setHandle(io.m_h); }
+ template<class U>
+ bool isA() { return !!dynamic_cast<U *>(m_h); }
IO<T> & operator=(const IO<T> & io) { if (m_h) m_h->delRef(); setHandle(io.m_h); return *this; }
T * operator->() { Assert(m_h); T * r = dynamic_cast<T *>(m_h); Assert(r); return r; }
bool isNull() { return dynamic_cast<T *>(m_h); }