From b78404d7662298a27706bc08e86e9bde7a6baa66 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 23 Nov 2011 08:48:56 -0800 Subject: 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. --- includes/Handle.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'includes/Handle.h') 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 & io) { if (io.m_h) setHandle(io.m_h); } template IO(const IO & io) { if (io.m_h) setHandle(io.m_h); } + template + bool isA() { return !!dynamic_cast(m_h); } IO & operator=(const IO & io) { if (m_h) m_h->delRef(); setHandle(io.m_h); return *this; } T * operator->() { Assert(m_h); T * r = dynamic_cast(m_h); Assert(r); return r; } bool isNull() { return dynamic_cast(m_h); } -- cgit v1.2.3