aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/autodecref.h
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-12-21 16:08:12 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-12-21 16:08:12 -0200
commitf54ddefd58b0ee7499c84c26beaab9452cd453cb (patch)
tree4be37439201aa6c1cac4b2ced877583f10be539f /libshiboken/autodecref.h
parent27f6ed14ad776cdc5a9587211709ffcc19b92d8f (diff)
Disabled AutoDecRef obj. copy. and added some useful cast operators.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'libshiboken/autodecref.h')
-rw-r--r--libshiboken/autodecref.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libshiboken/autodecref.h b/libshiboken/autodecref.h
index 53fb2643d..962bd2844 100644
--- a/libshiboken/autodecref.h
+++ b/libshiboken/autodecref.h
@@ -51,15 +51,20 @@ public:
* AutoDecRef constructor.
* /param pyobj A borrowed reference to a Python object
*/
- AutoDecRef(PyObject* pyobj) : m_pyobj(pyobj) {}
+ explicit AutoDecRef(PyObject* pyobj) : m_pyobj(pyobj) {}
+
~AutoDecRef() {
Py_XDECREF(m_pyobj);
}
/// Returns the pointer of the Python object being held.
PyObject* object() { return m_pyobj; }
+ operator PyObject*() { return m_pyobj; }
+ operator bool() const { return m_pyobj; }
private:
PyObject* m_pyobj;
+ AutoDecRef(const AutoDecRef&);
+ AutoDecRef& operator=(const AutoDecRef&);
};