From ebc46bf6b79bc818f55aa9f63294053b20bd6501 Mon Sep 17 00:00:00 2001 From: Nicolas 'Pixel' Noble Date: Mon, 21 Jan 2013 20:06:39 -0800 Subject: Adding the asA method to the IO template. --- includes/Handle.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/Handle.h b/includes/Handle.h index 091c59c..e12fab7 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -110,8 +110,10 @@ 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); } + template + bool isA() { return !!dynamic_cast(m_h); } + template + IO asA() { IO h(dynamic_cast(m_h)); return h; } IO & operator=(const IO & io) { if (m_h) m_h->delRef(); setHandle(io.m_h); return *this; } T * operator->() { AAssert(m_h, "Can't use %s->() with a null Handle", ClassName(this).c_str()); -- cgit v1.2.3