summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-29 14:03:24 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-29 16:20:41 -0300
commit7ac0c10741046f9079b6fdced015140a4846e0c1 (patch)
tree467fb729f3c3f9fcb5efd42e998b2866b9235a21
parent5c9f0f811e5d8eac4465b21a2255613aa9f543a7 (diff)
downloadshiboken-7ac0c10741046f9079b6fdced015140a4846e0c1.tar.gz
shiboken-7ac0c10741046f9079b6fdced015140a4846e0c1.tar.xz
shiboken-7ac0c10741046f9079b6fdced015140a4846e0c1.zip
Created utility function cast on AutoDecRef class.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--libshiboken/autodecref.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libshiboken/autodecref.h b/libshiboken/autodecref.h
index b9c5d29f..20ed168d 100644
--- a/libshiboken/autodecref.h
+++ b/libshiboken/autodecref.h
@@ -52,6 +52,12 @@ public:
inline operator PyTupleObject*() { return reinterpret_cast<PyTupleObject*>(m_pyobj); }
inline operator bool() const { return m_pyobj; }
inline PyObject* operator->() { return m_pyobj; }
+
+ template<typename T>
+ T cast()
+ {
+ return reinterpret_cast<T>(m_pyobj);
+ }
private:
PyObject* m_pyobj;
AutoDecRef(const AutoDecRef&);