summaryrefslogtreecommitdiff
path: root/includes/Handle.h
diff options
context:
space:
mode:
authorNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-21 20:06:39 -0800
committerNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-21 20:06:39 -0800
commitebc46bf6b79bc818f55aa9f63294053b20bd6501 (patch)
treef2ab5ae73d46ff3188089bcc4ff58748a26c052f /includes/Handle.h
parentfe2e7f51c8af87e12fa2f4ca86fa6fb6943f0588 (diff)
Adding the asA method to the IO template.
Diffstat (limited to 'includes/Handle.h')
-rw-r--r--includes/Handle.h6
1 files changed, 4 insertions, 2 deletions
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<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); }
+ template<class U>
+ bool isA() { return !!dynamic_cast<U *>(m_h); }
+ template<class U>
+ IO<U> asA() { IO<U> h(dynamic_cast<U *>(m_h)); return h; }
IO<T> & operator=(const IO<T> & 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());